CforChan @ 2017-02-27 17:41:18
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int n,c[302],m[302],e[302],sum[302],pos[302],i,j;
int temp,temp1,temp2;
int main()
{
cin>>n;
for(i=1;i<=n;i++)
cin>>c[i]>>m[i]>>e[i];
for(i=1;i<=n;i++)
{
sum[i]=c[i]+m[i]+e[i];
pos[i]=i;
}
for(i=1;i<=n;++i)
for(j=i+1;j<=n;j++)
if(sum[i]<sum[j])
{
temp=sum[i];sum[i]=sum[j];sum[j]=temp;
temp1=pos[i];pos[i]=pos[j];pos[j]=temp1;
}
else if(sum[i]==sum[j])
{
if(c[i]<c[j])
{
temp1=pos[i];pos[i]=pos[j];pos[j]=temp1;
}
if(c[i]==c[j])
{
if(m[i]<m[j])
{
temp1=pos[i];pos[i]=pos[j];pos[j]=temp1;
}
}
}
for(i=1;i<=5;++i)
{
cout<<pos[i]<<" "<<sum[i]<<endl;
}
}
by CforChan @ 2017-02-27 17:45:21
已解决
by 李志远 @ 2017-03-24 19:58:01
我也70,求助咋弄的