mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
18 lines
232 B
C++
18 lines
232 B
C++
|
#include <stdio.h>
|
||
|
int main(){
|
||
|
int n,i,j;
|
||
|
scanf("%d", &n);
|
||
|
int ans = 0, count=0;
|
||
|
i=1;
|
||
|
for(i=1;i<=n;i++){
|
||
|
for(j=1;j<=i;j++){
|
||
|
ans+=i;
|
||
|
count++;
|
||
|
if(count==n){
|
||
|
printf("%d", ans);
|
||
|
return 0;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return 0;
|
||
|
}
|