Wangxiaolong666 @ 2022-12-11 17:07:15
#include <iostream>
using namespace std;
int main()
{
int a=1,b=1,c=0,n;
cin>>n;
while(a<=n)
{
for(int i=1;i<=b;i++)
{
c=c+b;
a++;
if(a>b)
break;
}
b++;
}
cout<<c;
return 0;
}
by Katz @ 2022-12-11 17:11:40
看不懂你这写的什么
by shuyuan2016 @ 2022-12-25 20:39:34
#include <iostream>
using namespace std;
int n,q,c,s;
int main(){
cin>>n;
c=q=1;
for(int i=1;i<=n;i++){
s+=c;
q--;
if(q==0)
{
c++;
q=c;
}
}
cout<<s;
return 0;
}