#include<stdio.h> long long sum[100010]; int main() { int n; int i; sum[0]=0,sum[1]=1; for(i=2; i<100010; i++) { if(i%3==0)sum[i]=sum[i-1]+(long long)i*i*i; else sum[i]=sum[i-1]+i; } while(scanf("%d",&n)!=EOF&&n>=0) { printf("%I64d ",sum[n]); } return 0; }
****需注意的地方:
if(i%3==0)sum[i]=sum[i-1]+(long long)i*i*i;