TopCoder problem "CubeSum" used in TCO04 Wildcard (Division I Level One)



Problem Statement

    Given an int, N, return the number of ways to represent N as the sum of 4 non-negative perfect cubes. Do not count different permutations of the same 4 cubes more than once. For example, (0,0,0,1) is the same as (1,0,0,0).
 

Definition

    
Class:CubeSum
Method:count
Parameters:int
Returns:int
Method signature:int count(int N)
(be sure your method is public)
    
 

Constraints

-N will be between 1 and 100,000,000, inclusive.
 

Examples

0)
    
1
Returns: 1
Keep in mind that 0 is a perfect cube so 1 can be represented as 0+0+0+1
1)
    
4
Returns: 1
1+1+1+1 = 4
2)
    
2072
Returns: 4
0     + 1     + 7*7*7*   + 12*12*12 = 0  + 1   + 343  + 1728 = 2072
0     + 7*7*7 + 9*9*9    + 10*10*10 = 0  + 343 + 729  + 1000 = 2072
2*2*2 + 4*4*4 + 10*10*10 + 10*10*10 = 8  + 64  + 1000 + 1000 = 2072
4*4*4 + 4*4*4 + 6*6*6    + 12*12*12 = 64 + 64  + 216  + 1728 = 2072
3)
    
456
Returns: 0

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=3083

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=5885&pm=3083

Writer:

lars2520

Testers:

PabloGilberto , Yarin , vorthys

Problem categories:

Math