#include <stdio.h>
int calut(int m){
int count,temp,h ;
temp = m;
for (int j=1; temp-j>=0; j++){
temp=temp-j;
h=j;
count=1+(j-2)*(j-1)/2;
}
if((m-(h+1)*h/2)>0)
count=count+(m-(h+1)*h/2);
return count;
}
int main(){
int m,cnt=0;
scanf("%d",&m);
cnt=calut(m);
printf("%d\n",cnt);
return 0;
}
第一次笔试题调试成功,谨以此文章作为纪念,用以自勉!