AC

王艺翔  •  2年前


include

include

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;

}


评论:

nice


丁禾禾  •  2年前

请先登录,才能进行评论