Eli1 @ 2021-09-21 22:56:41
#include<cstdio>
int a[10005];
int main(){
int n;
scanf("%d",&n);
for(int i=1,t=1;i<=10005;t++){
int f=t;
while(f>0){
a[i++]=t+a[i-2];
f--;
}
}
printf("%d",a[n]);
return 0;
}
by yukimianyan @ 2021-09-21 22:58:33
a[i++]=t+a[i-2];
这个是未定义行为(UB),建议拆开写
by Eli1 @ 2021-10-06 15:47:12
thank you