王艺翔 • 2年前
using namespace std;
struct student{
int n,y,score;
};
bool cmp(student a,student b){
if(a.score==b.score){
if(a.y==b.y) return a.n<b.n;
else return a.y>b.y;
}else return a.score>b.score;
} student s[305]; int main(void){
int a,b,c,n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a>>b>>c;
s[i].n=i;
s[i].y=a;
s[i].score=a+b+c;
}
sort(s+1,s+1+n,cmp);
for(int i=1;i<=5;i++)
cout<<s[i].n<<" "<<s[i].score<<endl;
return 0;
}
评论:
请先登录,才能进行评论