【题目】
You just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2.
【输入】
In each case, there is an odd positive integer n.
【输出】
Print the sum. Make sure the sum will not exceed 2^31-1
样例:
输入:3
输出:10
代码:
#include<stdio.h>
__int64 shu[2600];
int main()
{
int i;
shu[1]=1;
for(i=3;i<2600;i+=2)
shu[i]=shu[i-2]+i*i;
int n;
while(~scanf("%d",&n))
printf("%I64d\n",shu[n]);
return 0;
}