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<iostream> #include<cstdio> using namespace std; int main() { // 公式 1^2+3^2+5^2+...+(2n-1)^2 ==n*(n+1)*(n+2)/6 unsigned __int64 n,s; while(scanf("%I64u",&n)!=EOF&&n!=0) { s=n*(n+1)*(n+2)/6; printf("%I64u\n",s); } return 0; }