Sphere Online Judge

Computer geeks! Show off your skills and claim the job of your dreams! RecruitCoders.com

SPOJ Problem Set (classical)

1724. Counting Triangles

Problem code: TRICOUNT

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).

Input

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.

Output

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)

Example

Input:
3
1
2
3

Output:
1
5
13

Added by:Unknown
Date:2007-08-05
Time limit:1s
Source limit:500B
Languages:All except: ERL JS PERL 6
Resource:Trần Huy Hưng

hide comments
2012-03-26 19:34:03 The Vagabond
@2012-02-14 02:14:35 Nickey
Nothing to understand case n =13 .It is same as any other case !
2012-02-14 02:14:35 Nickey
I dont understand the case n=13. Anyone help?
2012-02-14 02:10:49 Nickey


Last edit: 2012-02-15 21:07:35
2012-01-28 20:33:13 Shashank Jain
for 10^6 it is 247724688
2011-12-30 23:56:47 H. Gilles
@Sameer I have the same problem...
EDIT: N=3 does not equal thirteen! Look at the graphic again, it isn't a mistake!

Last edit: 2011-12-31 02:08:26
2011-12-13 14:04:57 Aditya Muttur
Are the answers in the limit of long int in C++?


Last edit: 2011-12-21 15:47:39
2011-11-20 10:47:44 Neeraj Bhat
@sarvesh ranjan
for n 999999,it is 249999874999750000
2011-11-20 10:43:43 Neeraj Bhat
@vaga for n level 5,it is 48
2011-11-09 08:36:07 sunny
what is the answer for test when n=10^6?? pls post few other output as well..
2011-10-16 10:24:46 The Vagabond
for level 4, is it 27?
for level 5, is it 38?
SPOJ System © 2012 Sphere Research Labs | Projekty informatyczne i aplikacje na zamówienie. All Rights Reserved.