hu1078725025 @ 2016-06-01 20:42:37
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
int a,b,c;
int n[4][10000];
int temp,count=1;
int pai[6],fen[6];
memset(n,0,sizeof(n));
memset(pai,0,sizeof(pai));
memset(fen,0,sizeof(fen));
scanf("%d",&a);
for(int i=0;i<a;i++)
{
for(int I=0;I<3;I++)
{
cin>>n[I][i];
}
n[3][i]=n[0][i]+n[1][i]+n[2][i];
}
for(int i=a-1;i>=0;i--)
{
for(int I=0;I<=a;I++)
{
if(n[3][i]<n[3][I])
count++;
}
if(count<=5)
{
pai[count]=i;
fen[count]=n[3][i];
}
count=1;
}
for(int i=1;i<6;i++)
{
cout<<pai[i]+1<<" "<<fen[i]<<endl;
}
}
by 琴音·袅袅 @ 2016-08-23 16:03:17
你个zz,这都不会
var n,i,j,t:longint;
a,b,c,d,e:array[1..10000]of longint;
begin
readln(n);
for i:=1 to n do
begin
readln(a[i],b[i],c[i]);
d[i]:=a[i]+b[i]+c[i];
e[i]:=i;
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if (d[i]<d[j])or(d[i]=d[j])and(a[i]<a[j])or(d[i]=d[j])and(a[i]=a[j])and(e[i]>e[j]) then
begin
t:=a[i];a[i]:=a[j];a[j]:=t;
t:=b[i];b[i]:=b[j];b[j]:=t;
t:=c[i];c[i]:=c[j];c[j]:=t;
t:=d[i];d[i]:=d[j];d[j]:=t;
t:=e[i];e[i]:=e[j];e[j]:=t;
end;
for i:=1 to 5 do
writeln(e[i],' ',d[i]);
end.
叫我红领巾