题目描述
You are the Chief Engineer of a fast growing start-up. You wish to place $K$ servers in some distinct locations from among $N$ locations. The locations, numbered $1, 2, \ldots, N$ are arranged in a circular manner. The distance between every adjacent location is 1 unit. $1$ and $N$ are adjacent.
You want to place the servers such that the maximum shortest distance between any two adjacent servers is as less as possible. Find this minimum possible distance that can be achieved, and also the minimum number of pairs of adjacent servers separated by this distance.
------ Input: ------
The first line contains a single integer, $T$, denoting the number of test cases.
Each test case consists of a single line containing two space-separated integers $N$ and $K$, denoting the number of locations, and the number of servers, respectively.
------ Output: ------
For test case, output two space-separated integers $D$ and $X$, denoting the minimum possible maximum shortest distance that can be achieved between any two adjacent servers, and the minimum number of pairs of servers separated by this distance, respectively, in a separate line.
------ Constraints ------
$1 ≤ T ≤ 10^{5}$
$3 ≤ K ≤ N ≤ 10^{9}$
----- Sample Input 1 ------
3
6 3
10 6
10 4
----- Sample Output 1 ------
2 3
2 4
3 2
----- explanation 1 ------
- Sample Test $1$: Let the locations be numbered from $1$ to $6$. We can place the servers at locations $1$, $3$ and $5$. Thus, the distances between locations $1$ and $3$, $3$ and $5$, and $5$ and $1$ are all $=2$, which is the lowest possible maximum distance that can be achieved here. There are $3$ pairs of locations separated by this distance.
- Sample Test $2$: Let the locations be numbered from $1$ to $10$. We can place the servers at locations $1,2,4,6,8$ and $10$. Thus, the minimum possible maximum distance between any two adjacent servers is $2$. There shall be at least $4$ pairs of servers separated by this distance. Here, they are $(2,4)$, $(4,6)$, $(6,8)$ and $(8,10)$.
输入格式
见题面
输出格式
见题面