Problem of the day
The first line of input contains an integer ‘T’ denoting the number of test cases.
The next ‘T’ lines represent the ‘T’ test cases.
The first and only line of each test case contains two space-separated integers ‘N’ and ‘K’ denoting the number of candies and number of friends respectively.
For each test case, return the total number of candies every person has at the end.
You do not need to print anything; it has already been taken care of. Just implement the given functions.
1 <= T <= 50
1 <= N <= 10^9
1 <= K <= 10^5
Time Limit: 1 sec
2
7 4
4 1
1 2 3 1
4
Test case 1:
Sanyam has 7 candies and 4 friends.
In the first turn, the first friend gets 1 candy, the second friend gets 2 candies and the third friend gets 3 candies. Now he has used up 6 candies and 1 candy is left. As per the condition, the fourth friend has to be given 4 candies, but there is only 1 left, hence he takes one only.
Test case 2:
As there is only one friend he will get the first candy, then the next two, and then the last one making the count 4.
2
10 3
3 2
5 2 3
1 2