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.

18 lines
462 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
int main() {
2 years ago
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;
2 years ago
}
}
return 0;
}