本题实际上考的是结构体和运算符的重载
#include<iostream>
#include<algorithm>
using namespace std;
const int N=310;
struct Stu{
int sno,c,m,e,tot;
bool operator<(const Stu &s)const{
if(tot!=s.tot)return tot>s.tot;
if(c!=s.c)return c>s.c;
return sno<s.sno;
}
}stu[N];
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
int c,m,e;
cin>>c>>m>>e;
int tot=c+m+e;
stu[i]={i,c,m,e,tot};
}
sort(stu+1,stu+n+1);
for(int i=1;i<=5;i++){
cout<<stu[i].sno<<' '<<stu[i].tot<<endl;
}
return 0;
}