#include <stdio.h>
#include <math.h>
int main(){
int N, id, x, y, bestid, worstid, best=10000, worst=0;
float dis;
scanf("%d", &N);
for(int i = 0; i < N; i++){
scanf("%d %d %d", &id, &x, &y);
dis = sqrt(x*x + y*y); //为什么一定要求平方根?直接比较平方和不行?
if(dis < best){
bestid = id;
best = dis;
}
if(dis > worst){
worstid = id;
worst = dis;
}
}
printf("%04d %04d", bestid, worstid);
return 0;
}
为什么一定要求平方根?直接比较平方和不行呢?