21 lines
370 B
C++
21 lines
370 B
C++
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
|
|
int res = 0;
|
|
int k = 0;
|
|
for (int i = 1;; i++)
|
|
for (int j = 0; j < i; j++) {
|
|
k++;
|
|
res += i;
|
|
if (k >= n) {
|
|
cout << res << endl;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
} |