a-a Very Easy Triangle counting GameTime
limit:1000MS
Memory Limit:64000KB
64bit IO Format:%lld &%llu SubmitStatusPracticeAcdream 1008
Description
Speedcell and Shoutmon love triangles very much. One Day,they is playing a game named "Triangle Counting".
In this Game,speedcell draws a round,and draws N points on the circumference of the round evenly,and marks as,.. ., N.
Then Speedcell connects these points using the following rules:
Step 1:connect The first point with the third Point,and Connect, the third point and the 5th point,..., connect the ith PO int with the
(i+2) th point (cycling when needed) ... It can ' t be stopped until we get back to the first point.
Step 2:if there exists some points which don ' t be connected still,choose one of the them (If marked "I"), and connect it with T He
(i+2) th point,then The (i+4) th point as Step1 .... If we get back to the ith Point,step 2 would be stopped.
Step 3:connect all the points as the order,..., n,1.
Now Speedcell wants to let Shoutmon count of the number of triangles on the figure.
Input
The first line of input contains T (t≤1000), indicating the number of cases.
Then T lines follow. Each line an integer N (1≤n≤1000), indicating the number of points.
Output
Each case a line, and output the case number first, then a single integer, indicating the number of triangles.
The answer should is moduloed by 20121111.
Sample Input
3146
Sample Output
Case #1:0Case #2:8Case #3:32
Learned a new mathematical posture.
At first glance is to find the law, indeed, but the law is more special, in n <= 7 o'clock, the number of triangles appear to be irregular state.
When greater than >7, the law is n * 5;
Acdream. A Very Easy Triangle counting Game (mathematical derivation)