| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 41402 | plj2026 | 【S】T1 | C++ | 解答错误 | 40 | 985 MS | 1820 KB | 944 | 2026-04-22 18:46:06 |
#include <bits/stdc++.h> using namespace std; #define int long long struct nd { double x, y; }; nd dis[100005]; bool cmp(nd xx, nd yy) { if (xx.x != yy.x) return xx.x < yy.x; return xx.y < yy.y; } double mhd(int x1, int y1, int x2, int y2) { return 1.0*abs(x1-x2) + 1.0*abs(y1-y2); } double jld(int x1, int y1, int x2, int y2) { return 1.0*sqrt(1.0*(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); } signed main() { int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> dis[i].x >> dis[i].y; } sort(dis+1, dis+n+1, cmp); double maxn = 0; for (int i = 1; i < n; i++) { maxn = max(maxn,1.0*mhd(dis[i].x,dis[i].y,dis[i+1].x,dis[i+1].y)/ jld(dis[i].x,dis[i].y,dis[i+1].x,dis[i+1].y)); } printf("%.12lf\n", maxn); } return 0; } /*用例 2 2 0 0 0 1 3 1 1 2 3 5 8 1.000000000000 1.371988681140*/