_Jarvis_ @ 2023-03-10 17:46:17
#include<bits/stdc++.h>
using namespace std;
int k,t=1,a=1,i=1,s;
int main(){
cin>>k;
while(t<k){
while(i<=a){
s+=a;
i++;
t++;
if(t>k){
cout<<s;
return 0;
}
}
i=1;
a++;
}
return 0;
}
by 46vvhb @ 2023-05-11 13:20:07
#include<bits/stdc++.h>
using namespace std;
int k,t=1,a=1,i=1,s;
int main(){
cin>>k;
while(t<=k){
while(i<=a){
s+=a;
i++;
t++;
if(t>k)
{
cout<<s;
return 0;
}
}
i=1;
a++;
}
return 0;
}