#K80927. Distributing Samples into Batches
Distributing Samples into Batches
Distributing Samples into Batches
You are given T test cases. For each test case, you are given two integers: s (the total number of samples) and k (the maximum batch size). Your task is to determine the number of completely filled batches and whether there is a partially filled batch.
For each test case, compute the following:
- \( \text{FullBatches} = \left\lfloor \frac{s}{k} \right\rfloor \)
- \( \text{PartialBatch} = \begin{cases} 1, & \text{if } s \bmod k \gt 0 \\ 0, & \text{if } s \bmod k = 0 \end{cases} \)
Output the result for each test case on a new line with the two numbers separated by a space.
inputFormat
The input is read from standard input (stdin
). It consists of:
- An integer T representing the number of test cases.
- T lines, each containing two space-separated integers s and k.
Constraints:
- \( 1 \leq T \leq 10^5 \)
- \( 1 \leq s, k \leq 10^9 \)
outputFormat
The output should be printed to standard output (stdout
). For each test case, print a single line with two integers separated by a space:
- The number of completely filled batches (\( \lfloor \frac{s}{k} \rfloor \)).
- A flag indicating a partially filled batch (1 if \( s \bmod k > 0 \), otherwise 0).
3
10 3
15 5
20 7
3 1
3 0
2 1
</p>