#include <bits/stdc++.h>
using namespace std;
struct student
{
int xuehao;
int yu,shu,ying,zf;
int ai;
};
bool cmp(student x,student y)
{
return (x.zf>y.zf||(x.zf==y.zf&&x.ai<y.ai));
}
student a[1002];
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i].yu>>a[i].shu>>a[i].ying;
a[i].zf=a[i].yu+a[i].shu+a[i].ying;
a[i].ai=i;
a[i].xuehao=i;
}
sort(a+1,a+n+1,cmp);
for(int i = 1;i<=5;i++)
{
cout<<a[i].xuehao<<" "<<a[i].zf<<endl;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
struct student
{
int xuehao;
int yu,shu,ying,zf;
int ai;
};
bool cmp(student x,student y)
{
return (x.zf>y.zf);
if(x.zf==y.zf)
{
return (x.yu>y.yu);
if(x.yu==y.yu)
{
return (x.xuehao<y.xuehao);
}
}
}
student a[1002];
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i].yu>>a[i].shu>>a[i].ying;
a[i].zf=a[i].yu+a[i].shu+a[i].ying;
a[i].ai=i;
a[i].xuehao=i;
}
sort(a+1,a+n+1,cmp);
for(int i = 1;i<=5;i++)
{
cout<<a[i].xuehao<<" "<<a[i].zf<<endl;
}
return 0;
}
求改