429. 奖学金
简单模拟
const int N=310;
struct Stu {
int id;
int c,m,e;
int sum;
bool operator<(const Stu &W) const
{
if(sum == W.sum)
{
if(c == W.c)
{
return id<W.id;
}
else return c>W.c;
}
else return sum>W.sum;
}
}a[N];
int n;
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
a[i].id=i+1;
cin>>a[i].c>>a[i].m>>a[i].e;
a[i].sum=a[i].c+a[i].m+a[i].e;
}
sort(a,a+n);
for(int i=0;i<5;i++)
cout<<a[i].id<<' '<<a[i].sum<<endl;
//system("pause");
return 0;
}