全部评论 1

  • #include<bits/stdc++.h>
    #include<algorithm>
    using namespace std;
    struct student{
    string name;
    int id;
    double h;
    }a[110];
    bool cmp(student x,student y){
    if(x.h!=y.h)return x.h>y.h;
    else return x.id<y.id;
    }
    int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
    cin>>a[i].name>>a[i].h>>a[i].id;
    }
    sort(a+1,a+n+1,cmp);
    cout<<a[1].name<<" "<<a[1].h<<" "<<a[1].id;
    return 0;
    }

    2025-04-12 来自 四川

    0
首页