题目描述
Gru wants to distribute $N$ bananas to $K$ minions on his birthday.
Gru does not like to just give everyone the same number of bananas, so instead, he wants to distribute bananas in such a way that each minion gets a $distinct$ amount of bananas. That is, no two minions should get the same number of bananas.
Gru also loves $gcd$. The higher the $gcd$, the happier Gru and the minions get. So help Gru in distributing the bananas in such a way that each Minion gets a distinct amount of bananas and gcd of this distribution is highest possible. Output this maximum gcd. If such a distribution is not possible output $-1$.
Note: You have to distribute $all$ $N$ bananas.
-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow.
- Each testcase consists of a single line of input, which has two integers: $N, K$.
-----Output:-----
For each testcase, output in a single line the maximum gcd or -1.
-----Constraints-----
- $1 \leq T \leq 100$
- $1 \leq N, K \leq 10^9$
-----Sample Input:-----
1
6 3
-----Sample Output:-----
1
-----EXPLANATION:-----
The only possible distribution is $[1, 2, 3]$. So the answer is 1.
输入格式
见题面
输出格式
见题面