puzexuan @ 2016-10-13 13:53:50
#include<iostream>
#include<cstring>
using namespace std;
int a[10000],b[10000],c[10000],s[10000],d[10000];
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;++i)
{
cin>>a[i]>>b[i]>>c[i];
s[i]=a[i]+b[i]+c[i];
d[i]=i;
}
for(int i=1;i<=n;++i)
for(int j=1;j<=n-i;++j)
if((s[j]<s[j+1])||(s[j]==s[j+1]&&a[j]<a[j+1])||(s[j]==s[j+1]&&a[j]==a[j+1]&&d[j]>d[j+1]))
{
int t=s[j];
s[j]=s[j+1];
s[j+1]=t;
int t0=d[j];
d[j]=d[j+1];
d[j+1]=t0;
}
for(int i=1;i<=5;++i)
cout<<d[i]<<" "<<s[i]<<endl;
return 0;
}
by 20050823abc @ 2016-11-12 14:55:13
......