SUMOFCUBES
Some natural numbers, like , can be expressed as the sum of three cubes of natural numbers: . Others, like , cannot be written in this form. Some natural numbers, like , can be expressed in this form in more than one way: .
Write a program that reads some natural numbers and finds out how many different ways each of them can be written as the sum of three cubes of natural numbers.
Input
The first line of the input will contain the number of numbers that will be given next. The following lines will each contain exactly one natural number .
Output
The output must consist of lines, each of which must contain exactly one integer, the number of ways in which the corresponding number of the input can be written as the sum of three cubes of natural numbers.
Constraints
1 T 10.000
0 N 1.000.000.000
Execution time limit: 1 sec.
Memory limit: 16 MB.
Example of Input - Output
STDIN (sumofcubes.in)
6
17
42
251
0
5104
1003
STDOUT (sumofcubes.out)
1
0
2
1
3
0
Example Explanation: The number 17 = 1+ 2+ 2 can be expressed in one way as the sum of three cubes. The number 251 = 1+ 5+5= 2+ 3+ 6 can be expressed in two ways as the sum of three cubes. The number 0 = 0+ 0+ 0 can be expressed in one way as the sum of three cubes. The number 5104 = 1+ 12+ 15= 2+ 10+ 16= 9+ 10+ 15 can be expressed in three ways as the sum of three cubes. Finally, the numbers 42 and 1003 cannot be expressed as the sum of three cubes.
Comments