You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
520 B
27 lines
520 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
const int N = 1e5 + 10;
|
|
int n, num;
|
|
int ans;
|
|
vector<int> c;
|
|
|
|
int main() {
|
|
scanf("%d", &n);
|
|
for (num = 2;; num++) {
|
|
if (ans + num > n) break;
|
|
ans += num;
|
|
c.push_back(num);
|
|
}
|
|
|
|
int r = n - ans;
|
|
while (r) {
|
|
for (int i = c.size() - 1; i >= 0 && r; i--) {
|
|
c[i] += 1;
|
|
r--;
|
|
}
|
|
}
|
|
for (int i = 0; i < c.size(); i++) printf("%d ", c[i]);
|
|
puts("");
|
|
return 0;
|
|
} |