题目描述
Chef wants you to distribute candies among $N$ kids who are sitting in a circle. However, he wants to make some kids jealous of others. Thus, he wants you to distribute candies in such a way that there is a difference of at least $K$ candies between two adjacent kids.
Given the value of $N$ and $K$, you need to find the minimum number of candies you need to satisfy the given conditions, such that, each kid gets at least one candy.
-----Input:-----
- First line will contain $T$, the number of testcases. Then the testcases follow.
- The only line of each testcase contains two space-separated integers $N$ and $K$.
-----Output:-----
For each test case, print a single line containing one integer ― the number of candies you need.
-----Constraints-----
- $1 \leq T \leq 10^6$
- $2 \leq N \leq 10^3$
- $0 \leq K \leq 10^4$
-----Sample Input:-----
1
2 1
-----Sample Output:-----
3
-----EXPLANATION:-----
The minimum number of candies required is $3$. One kid needs to have $1$ candy and the other needs to have $2$ candy to have a difference of $1$ candy between them.
输入格式
见题面
输出格式
见题面