陈知易 @ 2017-08-04 16:43:03
#include<iostream>
using namespace std;
const int ml=301;
int zf[ml],yw[ml],sx[ml],yy[ml],xh[ml],n,i,j;
int main()
{
cin>>n;
for(i=1;i<=n;i++)
{
cin>>yw[i]>>sx[i]>>yy[i];
zf[i]=yw[i]+sx[i]+yy[i];xh[i]=i;
}
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
if(zf[j]<zf[i]){swap(zf[i],zf[j]);swap(xh[i],xh[j]);}
if(zf[i]==zf[j]&&xh[i]<xh[j]){swap(zf[i],zf[j]);swap(xh[i],xh[j]);}
}
}
for(i=1;i<=5;i++){cout<<xh[i]<<" "<<zf[i]<<endl;}
return 0;
}