为什么70?(代码较短)

P1093 [NOIP2007 普及组] 奖学金

syh0313 @ 2016-03-04 13:16:19

program p1093;
var
 n:integer;
 a,x,k:array[1..300]of integer;
 i,y,z,j,b,c:integer;
begin
 readln(n);
 for i:=1 to n do
  begin
   readln(x[i],y,z);
   k[i]:=i;
   a[i]:=x[i]+y+z;
  end;
 for i:=1 to n do
  for j:=i to n do
   if (a[i]<a[j])or((a[i]=a[j])and(x[i]<x[j]))or((a[i]=a[j])and(x[i]=x[j])and(k[i]>k[j])) then
    begin
     b:=a[i]; a[i]:=a[j]; a[j]:=b;
     c:=k[i]; k[i]:=k[j]; k[j]:=c;
    end;
 for i:=1 to 5 do writeln(k[i],' ',a[i]);
end.

by syh0313 @ 2016-03-04 13:24:24

已解决


by xxzxg @ 2016-09-19 21:32:41

hh 23333


|