You are given a board of size n×nn×n, where nn is odd (not divisible by 22). Initially, each cell of the board contains one figure.
In one move, you can select exactly one figure presented in some cell and move it to one of the cells sharing a side or a corner with the current cell, i.e. from the cell (i,j)(i,j) you can move the figure to cells:
- (i−1,j−1)(i−1,j−1);
- (i−1,j)(i−1,j);
- (i−1,j+1)(i−1,j+1);
- (i,j−1)(i,j−1);
- (i,j+1)(i,j+1);
- (i+1,j−1)(i+1,j−1);
- (i+1,j)(i+1,j);
- (i+1,j+1)(i+1,j+1);
Of course, you can not move figures to cells out of the board. It is allowed that after a move there will be several figures in one cell.
Your task is to find the minimum number of moves needed to get all the figures into one cell (i.e. n2−1n2−1 cells should contain 00 figures and one cell should contain n2n2 figures).
You have to answer tt independent test cases.
Input
The first line of the input contains one integer tt (1≤t≤2001≤t≤200) — the number of test cases. Then tt test cases follow.
The only line of the test case contains one integer nn (1≤n<5⋅1051≤n<5⋅105) — the size of the board. It is guaranteed that nn is odd (not divisible by 22).
It is guaranteed that the sum of nn over all test cases does not exceed 5⋅1055⋅105 (∑n≤5⋅105∑n≤5⋅105).
Output
For each test case print the answer — the minimum number of moves needed to get all the figures into one cell.
Example
input
Copy
3 1 5 499993
output
Copy
0 40 41664916690999888
发现规律了;
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
ll n,num=0;
cin>>n;
for(ll i=1,k=8;i<=n/2;i++,k+=8)//i一定开long long
{
num+=i*k;
}
cout<<num<<endl;
}
return 0;
}