parent
f6b3d6eed8
commit
1a070f67d9
@ -1,27 +1,18 @@
|
|||||||
#include <bits/stdc++.h>
|
#include <bits/stdc++.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
const int N = 1e5 + 10;
|
|
||||||
int n, num;
|
|
||||||
int ans;
|
|
||||||
vector<int> c;
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
scanf("%d", &n);
|
int n, d;
|
||||||
for (num = 2;; num++) {
|
cin >> n >> d;
|
||||||
if (ans + num > n) break;
|
double x = 1.0 * n / d;
|
||||||
ans += num;
|
double pre = round(x);
|
||||||
c.push_back(num);
|
cout << pre << "/1" << endl;
|
||||||
}
|
for (int i = 1; i <= d; i++) {
|
||||||
|
for (int j = 1; j <= n; j++) {
|
||||||
int r = n - ans;
|
double cur = 1.0 * j / i;
|
||||||
while (r) {
|
if (abs(cur - x) >= abs(pre - x)) continue;
|
||||||
for (int i = c.size() - 1; i >= 0 && r; i--) {
|
cout << j << "/" << i << endl;
|
||||||
c[i] += 1;
|
pre = cur;
|
||||||
r--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < c.size(); i++) printf("%d ", c[i]);
|
|
||||||
puts("");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in new issue