|
发表于 2022-11-6 15:34:42
|
显示全部楼层
不用谢- #include<iostream>
- #include<cstdio>
- using namespace std;
- int main(){
- int a,c,b = 0;
- int d = 1;
- int i = 1;
- cin>>a;
- while (c<=a-1)
- {
- i = 1;
- while(i<=d and c<=a-1)
- {
- b += d;
- i += 1;
- c += 1;
- }
- d += 1;
- }
- cout<<b;
- return 0;
- }
复制代码 |
|