称检测点查询 ccf202009-1
备考ccf,记录下刷过的题
ccf202009-1
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int n, X, Y;
struct node {
int dis, info;
};
node nodes[1000];
bool cmp(node a, node b) {
return a.dis == b.dis ? a.info < b.info : a.dis < b.dis;
}
int main() {
cin >> n >> X >> Y;
int x, y;
for (int i = 0; i < n; i++) {
cin >> x >> y;
nodes[i].dis = (X - x)*(X - x) + (Y - y)*(Y - y);
nodes[i].info = i + 1;
}
sort(nodes, nodes + n, cmp);
for (int i = 0; i < 3; i++) {
cout << nodes[i].info << endl;
}
return 0;
}