http://118.190.20.162/view.page?gpid=T113
100分
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <math.h>
using namespace std;
const int MAXN = 202;
struct point{
int id;
int x;
int y;
double dis;
}points[MAXN];
bool cmp(point a, point b){
if(a.dis != b.dis){
return a.dis < b.dis;
}else{
return a.id < b.id;
}
}
int main(){
int n, x, y;
scanf("%d %d %d", &n, &x, &y);
point tmp;
int k = 0;
for(int i = 0; i < n; i++){
cin >> tmp.x >> tmp.y;
tmp.id = i+1;
tmp.dis = pow(pow(tmp.x-x, 2) + pow(tmp.y-y, 2), 0.5);
points[k++] = tmp;
}
sort(points, points+n, cmp);
for(int i = 0; i < 3; i++){
printf("%d\n", points[i].id);
}
return 0;
}
京公网安备 11010502036488号