#C10121. Taco Box Packing

    ID: 39292 Type: Default 1000ms 256MiB

Taco Box Packing

Taco Box Packing

You are given a number of test cases. For each test case, you are provided with a number k which represents the number of treats to be packaged. There are two types of boxes available:

  • A large box which can hold exactly 3 treats.
  • A small box which can hold exactly 1 treat.

The task is to determine the minimum number of boxes needed such that the total exactly equals k treats. The strategy is simple: use as many large boxes as possible (i.e. take the integer division of k by 3), and then use small boxes to pack the remaining treats (i.e. the remainder of k modulo 3). Mathematically, for every treat count \( k \), the number of large boxes is \( l = \lfloor k/3 \rfloor \) and the number of small boxes is \( s = k \bmod 3 \).

For example, if \( k = 14 \), then \( l = \lfloor 14/3 \rfloor = 4 \) and \( s = 14 \bmod 3 = 2 \); hence, you would use 2 small boxes and 4 large boxes.

inputFormat

The first line contains an integer ( t ), the number of test cases. The second line contains ( t ) space-separated integers, where each integer represents the number of treats to be packaged.

outputFormat

For each test case, output two integers separated by a space: the number of small boxes and the number of large boxes, in that order. Each test case's result should be printed on a new line.## sample

5
14 4 1 8 27
2 4

1 1 1 0 2 2 0 9

</p>