## 1382 - Sum of Cubes

Discussion around the problems of the COJ.
Forum rules
Remember that posting AC code is not allowed here. If you are going to ask a question or to post a solution, describe your algorithm instead. Posting AC code will be penalized.
dovier
Posts: 1143
Joined: 8 years ago
Location: Havana, Cuba
Gender:  ### 1382 - Sum of Cubes

axlluis
Posts: 17
Joined: 8 years ago
Gender: ### Re: 1382 - Sum of Cubes

Hi , i have problems with problems that requires a result MOD -some number - , because i dont understand MOD to well, the user phantom tell me that the MOD is the rest of the division of to numbers, but in this problem for the input 1 1000000000000000000 i aply this thing and give me a negative value, can any body explainme what for 1 1000000000000000000 the result is 441??

ymondelo20
Posts: 1968
Joined: 8 years ago
Location: Universidad de las Ciencias Informáticas
Gender: Contact:

### Re: 1382 - Sum of Cubes

A naive problem, the module (the rest of the integer division, in this case by 1000007) of any number can't be negative... the value will be always between 0 and the MODULE VALUE - 1 (0 and 1000006 for this problem). If you get a negative result, then probably you are using a wrong type of variable (INT instead LONG LONG in C/C++ for example).
"Every problem has a simple, fast and wrong solution" OJ's Main Law. 