#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
struct E{
char name[100];
int age;
int score;
}buf[1001];
struct Rule{
bool operator()(const E &s1,const E &s2){
if(s1.score!=s2.score)
return s1.score<s2.score;
else {
if(strcmp(s1.name,s2.name)==0)
return strcmp(s1.name,s2.name)<0;
else return s1.age<s2.age;
}
}
};
int main(){
int i,n;
while(cin>>n){
for(i=0;i<n;i++)
cin>>buf[i].name>>buf[i].age>>buf[i].score;
sort(buf,buf+n,Rule());
for(i=0;i<n;i++)
cout<<buf[i].name<<" "
<<buf[i].age<<" "<<buf[i].score<<endl;
}
return 0;
}
/*
3
abc 20 99
bcd 19 97
bed 20 97
*/
九度OJ1061解题报告
最新推荐文章于 2018-02-17 23:24:21 发布