NIT1 @ 2023-09-10 19:04:22
int n,i,k,j; cin>>n; i=0; while(n){ j=++i; while(j&&n){ k+=i; n--; j--; } } cout<<--k;
by syr1125 @ 2023-09-10 19:08:06
markdown呢
by ZhouZheyv @ 2023-09-28 22:53:24
@syr1125 我来重写一下
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,i=0,k,j;
cin>>n;
while(n!=0){
j=i+1;
while(j!=0 && n!=0){
k+=i;
n-=1;
j-=1;
}
}
cout<<--k;
return 0;
}