mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
21 lines
350 B
C++
21 lines
350 B
C++
#include<stdio.h>
|
|
#include<string.h>
|
|
int a[505];
|
|
int main()
|
|
{
|
|
int n,sum,i;
|
|
while(scanf("%d",&n)!=EOF)
|
|
{
|
|
for(i=n,sum=0;i>=1;i--)
|
|
{
|
|
sum=sum+(1+i)*i/2;
|
|
}
|
|
for(i=n-1;i>=0;i=i-2)
|
|
{
|
|
sum=sum+(1+i)*i/2;
|
|
}
|
|
printf("%d\n",sum);
|
|
}
|
|
return 0;
|
|
}
|