wsadjkl0 @ 2021-03-21 15:55:18
{
int coin=1,day,sum=0,k,n=0;
scanf("%d",&k);
for(day=1;day<=coin;day++)
{
sum+=coin;
n++;
if(coin==day)
{
coin++;
day=0;
}
if(n==k)
break;
}
printf("%d",sum);
return 0;
}
by wsadjkl0 @ 2021-03-21 15:56:00
vc的调试答案也不对
by _caiji_ @ 2021-03-21 15:57:19
@wsadjkl0 局部变量是随机值
by npqenqpve @ 2021-03-21 16:19:11
局部变量随机值,全局变量才是0
by wsadjkl0 @ 2021-03-21 20:12:57
@caijianhong 懂了,谢谢大佬