#include"stdio.h"
int main()
{
int n,s=0,c=0,a=1;//c为天数,从零开始,
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
s+=a;
c++;
if(c==n)
break;
}
a++;
if(c==n)
break;
}
printf("%d",s);
}
标签:break,int,stdio,c++,金币,++,循环,main,国王
来源: https://blog.csdn.net/asadvsssss/article/details/122140314