TCOUNT2 - Counting Triangles II
We define the LEVEL of a triangle as in the following illustrative image:
And we continue defining the LEVEL of a hexagon. It's called level N hexagon if it’s joined by 6 triangles, each one is a level N triangle.
Task: All you have to do is to count all triangles in the “level N” hexagon.
Input
The first line of the input contains an integer T - the number of test cases and T lines follow. Each line contains an integer N which is the level of the hexagon in that test case.
Output
For each test case, you should write a seperate line: the number of triangles in the “level N” hexagon. (All answers will fit within the range of a 64-bit positive integer)
Example
Input: 1 1 Output: 6
hide comments
Ruslan Al-Mandili:
2019-10-05 13:05:40
Guys the positive 64-integer means unsigned or the regular positive 64-integer range is enough? Answer: Unsigned 64-integers! Last edit: 2019-10-06 19:29:27 |
|
(Tjandra Satria Gunawan)(曾毅昆):
2015-02-04 10:01:52
I can't see the image too!
|
|
MaHmOuD.:
2015-02-03 20:08:28
Images are broken.. i can't see them.
|
|
numerix:
2010-01-28 15:04:00
The result for n=1000000 is correct, the result for n=5555555 is wrong. The correct result doesn't fit into a 64-bit integer. Last edit: 2010-01-28 15:04:40 |
|
anshuman mishra:
2010-01-25 15:50:27
i,m too getting same answer for (1000000 --> 3500002250000500000) and (5555555 -->
|
Added by: | nha.duong |
Date: | 2007-08-06 |
Time limit: | 0.100s |
Source limit: | 300B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ASM32 C CPP C99 D PAS-GPC PAS-FPC |
Resource: | Trần Huy Hưng |