比赛 NOIP2007普及组(复现) 评测结果 AAAAAAAAAA
题目名称 奖学金 最终得分 100
用户昵称 AGNING 运行时间 0.006 s
代码语言 C++ 内存使用 13.67 MiB
提交时间 2020-02-09 17:31:00
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
struct student{
	int Cscore;
	int id;
	int Mscore;
	int Escore;
	int sum_score;
};
student Std[400];
int cmp(student a,student b){
	if(a.sum_score==b.sum_score){
		if(a.Cscore==b.Cscore) return a.id<b.id;
		return a.Cscore>b.Cscore;
	}
	return a.sum_score>b.sum_score;
}
int main()
{
	freopen("pj07-1.in","r",stdin);
	freopen("pj07-1.out","w",stdout);
	int N;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>Std[i].Cscore>>Std[i].Mscore>>Std[i].Escore;
		Std[i].sum_score=Std[i].Cscore+Std[i].Mscore+Std[i].Escore;
		Std[i].id=i+1;
	}
	sort(Std,Std+N,cmp);
	for(int i=0;i<5;i++){
		cout<<Std[i].id<<" "<<Std[i].sum_score<<endl;
	}
	
}