~/algor $ cat problems/kubiklardan-zinapoya
A staircase of cubes
Easy
1000 ms
64 MB
31%
A staircase is built from cubes: the first step has cube, the second , the third and so on; every step must be complete. What is the largest number of steps that can be built, and how many cubes are left over? This question is asked times, each time for its own .
Input
The first line contains a positive integer . Each of the next lines contains one positive integer .
Output
lines, each with two integers: the number of steps and the number of cubes left over.
Note
Examples
Input #1
3 8 1 6
Output #1
3 2 1 0 3 0
Input #2
2 2 1000000000000000000
Output #2
1 1 1414213561 1234742859