#K59442. Minimum Chocolate Purchases

    ID: 30865 Type: Default 1000ms 256MiB

Minimum Chocolate Purchases

Minimum Chocolate Purchases

You are given two positive integers n and k. Here, n represents the minimum number of chocolates you need, and k is the number of chocolates provided in a bundle purchase.

You can purchase chocolates in one of two ways:

  • Buy a single chocolate, or
  • Buy a bundle that gives you exactly k chocolates.

Your task is to determine the minimum number of purchases required to obtain at least n chocolates. Mathematically, the answer is obtained by computing the ceiling of \( \frac{n}{k} \), i.e., $$\lceil\frac{n}{k}\rceil$$.

For example, if n = 5 and k = 2, then the answer is 3 because purchasing two bundles gives you 4 chocolates and you need one additional purchase (which can be either a bundle or a single chocolate) to reach at least 5 chocolates.

inputFormat

The input is read from standard input (stdin).

The first line contains a single integer T representing the number of test cases. Each of the next T lines contains two space-separated integers n and k.

outputFormat

For each test case, print a single line to standard output (stdout) with the minimum number of purchases required to obtain at least n chocolates.## sample

5
5 2
10 3
12 5
9 9
100 15
3

4 3 1 7

</p>