hdlovecc @ 2016-05-07 22:01:44
#include <stdio.h>
int main(){
int i,K,j,sum = 0,t = 1,a[100001] = {0},b[100001] = {0};
scanf("%d",&K);
for (i = 1; i <= K; i++) a[i] = i;
for (i = 1; i <= K; i++){
for (j = 0; j <= t - 1; j++) if(i + j <= K) b[i + j] = a[t];
i+=j - 1; t++;
}
//for (i = 1; i <= K + 1; i++) printf("%d ",a[i]); printf("\n");
//for (i = 1; i <= K + 1; i++) printf("%d ",b[i]); printf("\n");
for (i = 1; i <= K; i++) sum+=b[i];
printf("%d",sum);
return 0;
}
by 1jia1 @ 2016-05-08 14:17:40
re都不知道是什么
by Num233 @ 2016-05-08 18:30:11
我记得main中数组不能开这么大,你放外面试试