Sage_sword @ 2020-09-11 21:02:28
#include<iostream>
using namespace std;
int main () {
int n,sum=0,c=0;
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
sum+=i;
c++;
}
if(c>=n)break;
}
cout<<sum<<endl;
return 0;
}
by ducati @ 2020-09-11 21:04:46
@Sage_sword long long呢
by sheeplittlecloud @ 2020-09-11 21:20:37
if(c>=n)break;
要放在循环里
by cilinya @ 2020-09-16 15:25:32
@Sage_sword 没有考虑到类似7天的情况