rookiepush @ 2017-04-14 19:26:26
#include<iostream>
#include<cstring>
using namespace std;
struct student
{
int number;
int scoreEn;
int scoreMa;
int scoreCh;
}stu1[305];
int main()
{
int i,j,k,n,sum[10001];
cin>>n;
for(i=1;i<=n;i++)
{
cin>>stu1[i].scoreEn;
cin>>stu1[i].scoreMa;
cin>>stu1[i].scoreCh;
sum[i]=stu1[i].scoreEn+stu1[i].scoreMa+stu1[i].scoreCh;
}
for(i=1;i<=n;i++)
{
for(j=i+1;j<=n;j++)
if(sum[j]>sum[i])
{
k=sum[i];sum[i]=sum[j];sum[j]=k;
k=stu1[i].number;stu1[i].number=stu1[i+1].number;stu1[i+1].number=k;
}
for(i=1;i<=5;i++)
{
if(sum[i]=sum[j])
if(stu1[i].scoreCh>stu1[j].scoreCh)
{
k=stu1[i].number;stu1[i].number=stu1[j].number;stu1[j].number=k;
}
if(stu1[i].scoreCh=stu1[j].scoreCh)
continue;
}
for(i=1;i<=5;i++)
{
cout<<stu1[i].number;
cout<<sum[i];
}
}