Ուղարկել | Բոլոր լուծումները | Լավագույն լուծումները | Վերադառնալ ցուցակին |
ACM0307 - SUB TRIANGLES |
Find the number of triangles of length 1, contained in an equilateral grid triangle of length l.
Your task is to find the total number of triangles of length 1 which can be seen in an image of an equilateral grid triangle of length l.
Input.
The input will begin with a single integer P on the first line, indicating the number of cases that will follow.
The remaining lines of the input will consist of one integer l per line, which is the equilateral grid triangle length. All integers will be less than 1,000,000 and greater than 0. The length l will be less than 100,000.
You should process all integers and for each integer l, determine the total number of triangles of length 1 which can be seen in an image of an equilateral grid triangle of length l.
You can assume that no operation overflows a 32-bit integer.
Output.
For each integer l, you should output the total number of triangles of length 1 which can be seen in an image of an equilateral grid triangle of length l, with one line of output for each line of input.
Sample test.
N |
stdin |
stdout |
1 |
4 1 2 3 4 |
1 4 9 16 |
Ավելացրեց. | Հրանտ Հովհաննիսյան |
Ամսաթիվ. | 2016-07-23 |
Ժամանակի սահմանափակումը. | 1s |
Ծրագրի տեքստի սահմանափակումը. | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Լեզուներ. | Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE |
Աղբյուրը. | Nigerien Collegiate Programming Contest, 2016 |