- 奖学金
- 2017-09-24 07:43:43 @
#include<iostream>
#include<algorithm>
#include<fstream>
using namespace std;
struct stu{
int ch,math,eng,zf,num;
};
stu a[295];
int n;
int cmp(stu x,stu y)
{
if(x.zf==y.zf) return x.ch>y.ch ;
else return x.zf>y.zf;
if(x.zf==y.zf&&x.ch==y.ch) return x.num<y.num;
}
int main()
{
//freopen("money.in","r",stdin);
//freopen("money.out","w",stdout);
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i].ch >>a[i].math >>a[i].eng ;
a[i].zf =a[i].ch +a[i].math +a[i].eng ;
a[i].num =i+1;
}
sort(a,a+n,cmp);
for(int i=0;i<5;i++)
cout<<a[i].num<<" "<<a[i].zf<<endl;
return 0;
}
3 条评论
-
Ey3JeU LV 10 @ 2017-09-24 16:26:27
你加我QQ我叫你吧o(>﹏<)o 怪可怜的 408939310
-
2017-09-24 09:14:36@
so water
-
2017-09-24 09:14:27@
zhazha
- 1