Submit | All submissions | Best solutions | Back to list |
GENCHESS - Generalized Chess |
The emperor's younger brother, Minimus, is an excellent chess player who has never lost a game. Let us ignore for the moment the fact that anyone who might dare defeat him would likely suffer a horrible death. Having mastered the usual game, which is played on a board of size 8, Minimus wants to generalize chess so that it can be played on a square board of arbitrary size. Unfortunately, Minimus skipped class so he never learned his multiplication tables, so he'll give you a number N, and it will be up to you to tell him how many squares a chessboard of that size would have. Don't worry, Minimus can't count higher than a million, so that's the highest number you need to be able to handle.
Input
There will be several test cases, each consisting of a single positive integer on a separate line, representing a possible value of N. A value of zero indicates the end of input and should not be processed.
Output
For each test case, output a single line containing the number of squares on a chessboard of size N.
Example
Input: 8 1 42 999999 0 Output: 64 1 1764 999998000001
Added by: | Miorel Palii |
Date: | 2010-01-24 |
Time limit: | 1s |
Source limit: | 4096B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | own problem statement; used in practice round of a few contests |