TRICOUNT - Counting Triangles
We define the LEVEL of a triangle as in the following illustrative image:
Task: Your task is very easy. All you have to do is to count all triangles in the biggest one (Level N).
The first line of the input contains an integer T (T ≤ 10000) - the number of test cases and T lines follow. Each line contains an integer N (1 ≤ N ≤ 106) which is the level of the triangle in that test case.
For each test case, you should write a seperate line: the number of triangles in the biggest one (Level N). (All answers will fit within the range of a 64-bit integer)
Source limit is 500 bytes.
@Priyam Mitra - For Level 3, there will be 9 small triangles, 3 medium triangles and 1 big triangle.
By omitting the figure for the stage 3, problem statement is confusing and suggests that at each step, every triangle is divided into four triangles. As comments show, many spojer are confused, and some even believe that 13 is an erroneous response for the stage 3... So, to clarify : at stage N, the sides of the initial triangle are divided into N parts. And, indeed, 13 is the correct counting at stage 3.Last edit: 2014-05-25 01:35:02