#C10829. Tournament Outcomes Calculation

    ID: 40077 Type: Default 1000ms 256MiB

Tournament Outcomes Calculation

Tournament Outcomes Calculation

In this problem, you are given n tournaments, each with a certain number of participants. For each tournament, you must determine the maximum number of teams that can be formed if each team consists of exactly k participants, and also compute the number of participants left over.

You can use the following formulas for each tournament with p participants:

  • \(\text{teams} = \left\lfloor \frac{p}{k} \right\rfloor\)
  • \(\text{leftover} = p \bmod k\)

Output the result for each tournament on a separate line with two space-separated integers: the first is the number of teams, and the second is the number of leftover participants.

inputFormat

The input is read from standard input (stdin) and has the following format:

  • The first line contains an integer n representing the number of tournaments.
  • The second line contains n space-separated integers, where each integer represents the number of participants in a tournament.
  • The third line contains an integer k representing the team size.

outputFormat

For each tournament, output a line with two space-separated integers: the maximum number of teams that can be formed and the number of leftover participants.

## sample
3
10 11 25
3
3 1

3 2 8 1

</p>