parent
f6b3d6eed8
commit
1a070f67d9
@ -1,27 +1,18 @@
|
||||
#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--;
|
||||
int n, d;
|
||||
cin >> n >> d;
|
||||
double x = 1.0 * n / d;
|
||||
double pre = round(x);
|
||||
cout << pre << "/1" << endl;
|
||||
for (int i = 1; i <= d; i++) {
|
||||
for (int j = 1; j <= n; j++) {
|
||||
double cur = 1.0 * j / i;
|
||||
if (abs(cur - x) >= abs(pre - x)) continue;
|
||||
cout << j << "/" << i << endl;
|
||||
pre = cur;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < c.size(); i++) printf("%d ", c[i]);
|
||||
puts("");
|
||||
return 0;
|
||||
}
|
Loading…
Reference in new issue