TrianglesProblem code: ENCD09 |
Sam has pencils of different lengths, that follow an order. If he has n pencils than their lengths are in increasing order starting from 1, for example: if he has 4 pencils then they are of length 1,2,3,4. Thus if he has n pencils, then he has exactly one pencil of each the lengths from 1 through n.
Input
Each test case will contain an integer n(3<=n<=1000000), the number of pencils in sam s collection.Terminate the input with n=0.
Output
For each test case, output on a line the number of different triangles you can make with sam's pencils. Triangles X and Y are different if there is at least one pencil in X that is not in Y. A triangle has area strictly greater than 0.
Example
Input: 3 4 10 0 Output: 0 1 50
| Author: | rscrbv |
| Date Added: | 19-01-2010 |
| Time Limit: | - 2 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions
