parent
1a070f67d9
commit
187ef655bf
@ -1,26 +1,39 @@
|
|||||||
#include <bits/stdc++.h>
|
#include <bits/stdc++.h>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
// 1498 902
|
|
||||||
|
struct node {
|
||||||
|
int x, y;
|
||||||
|
};
|
||||||
|
node a[110];
|
||||||
|
int n, L;
|
||||||
|
|
||||||
|
vector<int> X, Y;
|
||||||
|
|
||||||
|
int ans;
|
||||||
int main() {
|
int main() {
|
||||||
int n, d;
|
cin >> n >> L;
|
||||||
cin >> n >> d; // 最后一个形式是: n/d
|
for (int i = 1; i <= n; ++i) cin >> a[i].x >> a[i].y;
|
||||||
// 最后一个数的小数
|
|
||||||
double x = 1.0 * n / d;
|
for (int i = 1; i <= n; i++) {
|
||||||
double pre = round(x); // 前一个小数
|
X.push_back(a[i].x);
|
||||||
// 第一个
|
X.push_back(a[i].x - L);
|
||||||
cout << pre << "/1" << endl;
|
Y.push_back(a[i].y);
|
||||||
|
Y.push_back(a[i].y - L);
|
||||||
// 从第二个开始
|
}
|
||||||
// 分母
|
|
||||||
for (int i = 1; i <= d; i++) {
|
for (int i = 0; i < X.size(); i++) {
|
||||||
// 分子
|
for (int j = 0; j < Y.size(); j++) {
|
||||||
for (int j = 1; j <= n; j++) {
|
int cnt = 0;
|
||||||
double cur = 1.0 * j / i; // 当前枚举到的小数
|
int lx = X[i], ly = Y[j];
|
||||||
if (abs(cur - x) >= abs(pre - x)) continue; // 如果当前枚举到的小数与最后小数的距离,大于,上一个小数与最后小数的距离
|
for (int k = 1; k <= n; k++)
|
||||||
// 说明,现有枚举到的数更贴近目标,需要打印
|
if (a[k].x >= lx && a[k].x <= lx + L && a[k].y >= ly && a[k].y <= ly + L)
|
||||||
cout << j << "/" << i << endl;
|
cnt++;
|
||||||
pre = cur; // 将上一个小数的距离更新为现在小数的距离,为了下一次循环做准备工作
|
|
||||||
|
ans = max(ans, cnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cout << ans << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in new issue