OPUY @ 2022-06-26 14:39:38
我觉得没问题啊?
#include <iostream>
using namespace std;
int n,ans=0,day=1;//n为总天数,day为当前天数,ans为总金币
int main(){
cin >>n;
for(int i=1;day<=n;){//控制每一轮发金币
for(int j=1;j<=i;j++){//i天,每天发i枚金币
ans+=i;
day++;
}
i++;//下一轮初始化
}
cout <<ans<<endl;
return 0;
}
by ssxvngn @ 2022-06-26 14:44:23
@OPUY j<=i同时也要day<=n吧
by OPUY @ 2022-06-26 14:47:48
@一个pupil 十分感谢 是我粗心了
by _technoblade_ @ 2022-07-25 17:46:55
day<=n