求助

P1093 [NOIP2007 普及组] 奖学金

引领世界 @ 2016-12-22 19:10:56

n到多大?


by chenshengwei @ 2016-12-23 18:57:55

  var  a,no,s:array[1..300]of longint;
n,i,j,x,y,t:longint;
begin
  read(n);
  for i:=1 to n do
  begin
  readln(a[i],x,y);
  s[i]:=a[i]+x+y;
  no[i]:=i;
  end;
  for i:=1 to n do
    for j:=i+1 to n do
    if (s[i]<s[j])or(s[i]=s[j])and(a[i]<a[j])or((s[i]=s[j])and(a[i]<a[j])or(no[i]>no[j])) then
    begin
      t:=s[i];s[i]:=s[j];s[j]:=t;
      t:=a[i];a[i]:=a[j];a[j]:=t;
      t:=no[i];no[i]:=no[j];no[j]:=t;
    end;
   for i:=1 to 5 do   writeln(no[i],' ',s[i]);
end. 

是pascal的吗?


|