一只题解
2025-08-27 15:14:08
发布于:上海
1阅读
0回复
0点赞
#include<bits/stdc++.h>>
using namespace std;
struct student{
string a;
int b,c;
};
bool cmp(student x,student y){
if(x.b>y.b)return true;
else if(x.b<y.b)return false;
else{
if(x.c<y.c)return true;
else if(x.c>y.c)return false;
else{
if(x.a>y.a)return true;
else return false;
}
}
}
int main(){
int n;
cin>>n;
student stu[n+1];
for(int i=1;i<=n;i++){
cin>>stu[i].a;
cin>>stu[i].b;
cin>>stu[i].c;
}
sort(stu****tu+n+1,cmp);
for(int i=1;i<=n;i++){
cout<<stu[i].a<<endl;
}
}
这里空空如也
有帮助,赞一个