Problem Description
You just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2.
Input
In each case, there is an odd positive integer n.
Output
Print the sum. Make sure the sum will not exceed 2^31-1
Sample Input
3
Sample Output
10
#include <cstdio>
int main(int argc, const char* argv[])
{
__int64 n;
while (scanf("%I64d", &n) == 1)
{
n = (n>>1) + 1;
printf("%I64d\n", n*(2*n+1)*(2*n-1)/3);
}
return 0;
}