- 奖学金
- 2018-07-15 22:36:19 @
var
n,i,j,q:integer;
a,b,c,d,e:array[1..300] of integer;
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 do
for j:=i to n do
if d[j]>d[i] then
begin
q:=a[j];a[j]:=a[i];a[i]:=q;
q:=b[j];b[j]:=b[i];b[i]:=q;
q:=c[j];c[j]:=c[i];c[i]:=q;
q:=d[j];d[j]:=d[i];d[i]:=q;
q:=e[j];e[j]:=e[i];e[i]:=q;
end
else if (d[j]=d[i])and(e[j]<e[i]) then
begin
q:=a[j];a[j]:=a[i];a[i]:=q;
q:=b[j];b[j]:=b[i];b[i]:=q;
q:=c[j];c[j]:=c[i];c[i]:=q;
q:=d[j];d[j]:=d[i];d[i]:=q;
q:=e[j];e[j]:=e[i];e[i]:=q;
end;
for i:=1 to 5 do
writeln(e[i],' ',d[i]);
end.