202009-1 称检测点查询

水题。

const int N=210;
PII dist[N];
int n,x,y;

int get(int a,int b,int c,int d)
{
    return (a-c)*(a-c)+(b-d)*(b-d);
}

int main()
{
    cin>>n>>x>>y;

    for(int i=0;i<n;i++)
    {
        int a,b;
        cin>>a>>b;
        dist[i]={get(x,y,a,b),i+1};
    }

    sort(dist,dist+n);
    for(int i=0;i<3;i++)
        cout<<dist[i].se<<endl;
    //system("pause");
    return 0;
}
posted @ 2021-03-23 17:11  Dazzling!  阅读(12)  评论(0编辑  收藏  举报