#K40407. Forming Maximum Teams

    ID: 26635 Type: Default 1000ms 256MiB

Forming Maximum Teams

Forming Maximum Teams

In this problem, you are given the total number of players (S) and the number of players required to form a team (M). Your task is to determine the maximum number of complete teams that can be formed and the number of players who remain unassigned. Mathematically, the number of teams is given by (\lfloor S/M \rfloor) and the remainder is given by (S \mod M). Note that if (M = 0), no team can be formed and all players remain unassigned.

inputFormat

The first line of input contains a single integer (T) representing the number of test cases. Each of the following (T) lines contains two space-separated integers (S) and (M), where (S) is the total number of players and (M) is the number of players required to form a team.

outputFormat

For each test case, output two space-separated integers on a new line representing the maximum number of complete teams that can be formed and the number of unassigned players. For the edge case where (M = 0), output should be 0 S.## sample

3
10 3
25 5
12 7
3 1

5 0 1 5

</p>