<< 求赞求赞
算法
$\large{自定义排序}$
C++ 代码
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
struct Student{
string name;
int age,result;
}student[100100];
bool cmp(Student a,Student b){
if(a.result!=b.result) return a.result<b.result;
else if(a.name!=b.name) return a.name<b.name;
else return a.age<b.age;
}
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++) cin>>student[i].name>>student[i].age>>student[i].result;
sort(student+1,student+n+1,cmp);
for(int i=1;i<=n;i++) cout<<student[i].name<<' '<<student[i].age<<' '<<student[i].result<<endl;
return 0;
}