40pts求调
查看原帖
40pts求调
1095318
ZhangZhuoxi楼主2025/7/26 11:03
#include <bits/stdc++.h>
using namespace std;
int xo, yo, xt, yt, n;
double ans1, ans2;

int main() {
	cin >> xo >> yo >> xt >> yt >> n;
	for (int i = 1; i <= n; i++) {
		int x, y;
		cin >> x >> y;
		double b1 = sqrt((x - xo) * (x - xo) + (y - yo) * (y - yo));
		double b2 = sqrt((x - xt) * (x - xt) + (y - yt) * (y - yt));
		if (b1 < b2) {
			ans1 = max(ans1, b1);
		} else if (b2 < b1) {
			ans2 = max(ans2, b2);
		} else {
			if (b1 < ans1) {
				continue;
			} else if (b2 < ans2) {
				continue;
			} else {
				ans1 = max(ans1, b1);
				ans2 = max(ans2,b2);
			}
		}
	}
	cout << ans1 *ans1 + ans2 *ans2;
	return 0;
}

2025/7/26 11:03
加载中...