P22060 [CodeChef] MINPIZZAS
普及
题目描述

Chef is throwing a party for his N friends. There is a pizza store nearby and he wants to buy pizza for his friends. Each pizza has exactly K slices. Chef's friends get sad if one gets more slices than the other. Also, Chef gets sad if there are some pizza slices left. More formally, suppose Chef buys P pizzas, then everyone is happy if and only if there is a way to distribute $K \cdot P slices between N$ friends.

You need to find the minimum number of pizzas Chef has to buy to share all the slices among his friends so that none of his friends gets sad. Note that Chef hates pizza and doesn't take any slices.

------ Input Format ------

  • First line of input contains T, the number of test cases. Then the test cases follow.
  • Each test case contains two space-separated integers N and K, where N is the number of friends of chef and K is the number of slices in a pizza.

------ Output Format ------

For each test case, print the minimum number of pizzas chef has to buy to share among his friends so that none of his friends gets sad.

------ Constraints ------

$1 ≤ T ≤ 2 \cdot 10^{5}$
$1 ≤ N, K ≤ 10^{9}$

------ subtasks ------

Subtask 1 (100 points): Original constraints

----- Sample Input 1 ------
3
2 2
2 3
4 2

----- Sample Output 1 ------
1
2
2

----- explanation 1 ------
- Test case $1$: One pizza has $2$ slices. And there are $2$ friends. So chef can just buy one pizza and give one slice to one friend and another slice to another friend.
- Test case $2$: One pizza has $3$ slices. And there are $2$ friends. So chef can't share one pizza without being left out with a slice. So he needs to buy at least $2$ pizzas. And if he buys $2$ pizzas, he can give $3$ slices to one friend and $3$ to another. So the minimum number of pizzas chef needs to buy is equal to $2$.
- Test case $3$: One pizza has $2$ slices. And there are $4$ friends. So chef can't share one pizza among the $4$ friends. So he needs to buy at least $2$ pizzas. And if he buys $2$ pizzas, he can give $1$ slice to each of his friends. So the minimum number of pizzas chef needs to buy is equal to $2$.

输入格式

见题面

输出格式

见题面

样例输入
3 2 2 2 3 4 2
样例输出
1 2 2