70分

P1093 [NOIP2007 普及组] 奖学金

lixu123 @ 2016-02-28 10:44:35

program Project1;
var
  i,j:longint;
  n,t:qword;
  a,b,c:array[1..10000] of qword;
begin
  readln(n);
  for i:=1 to n do
  begin
    readln(a[i],b[i],c[i]);
    b[i]:=a[i]+b[i]+c[i];
    c[i]:=i;
  end;
  for i:=1 to n do
  begin
    for j:=1 to i-1 do
    if (b[i]>b[j])or((b[i]=b[j])and(a[i]>a[j])) then
                                                begin
                                                  t:=b[i];
                                                  b[i]:=b[j];
                                                  b[j]:=t;
                                                  t:=c[i];
                                                  c[i]:=c[j];
                                                  c[j]:=t;
                                                end;
  end;
  for i:=1 to 5 do
   writeln(c[i],' ',b[i]);
readln;
readln;
end.

|