AC
2024-05-05 10:13:45
发布于:北京
22阅读
0回复
0点赞
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
int gold = 1, r = 1;
int sum = 0;
for(int i = 1; i <= n; i++){
sum += gold;
if(r == gold){
gold++;
r = 1;
continue;
}else{
r++;
}
}
cout << sum;
return 0;
}
这里空空如也
有帮助,赞一个