Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

大家帮我找找错误Pascal

Posted by asdwerg at 2010-03-09 22:03:03 on Problem 1922
请大家找找怎么错了,两组数据都对的,但显示Runtime Error:
const max=1000000;
var n,j:integer;
  a:array[1..1000] of real;
  b:array[1..1000] of integer;
  i:integer;
procedure qsort(i,j:integer);
var
  temp:real;
  x,y:integer;
  si,fst:boolean;
begin
  if j<i then exit;
  x:=i;
  y:=j+1;
  temp:=a[i];
  while x<>y do begin
    repeat
      dec(y);
    until (a[y]<temp)or(a[x]=a[y]);
    a[x]:=a[y];
    if x<>y Then Begin
      repeat
        inc(x);
      until (a[x]>temp)or(a[x]=a[y]);
      a[y]:=a[x];
    end;
  end;
  a[x]:=temp;
  qsort(i,x-1);
  qsort(x+1,j);
end;
begin
  readln(n);
  while (n<>0) do begin
    fillchar(a,sizeof(a),0);
    i:=0;
    repeat
      i:=i+1;
      read(a[i]);
      read(b[i]);
      if not((a[i]<=0) or (b[i]<0)) then a[i]:=4.5/a[i]*3600+b[i] else
        a[i]:=max;
    until i=n;
    qsort(1,n);
    if trunc(a[1])=a[1] then writeln(trunc(a[1])) else
      writeln(trunc(a[1])+1);
    readln(n);
  end;
end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator