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

为什么总是runtime error

Posted by windy4573 at 2005-11-13 21:05:19 on Problem 1013
program pku1013;
var
  n,i,j,k:integer;
  a:array[1..12]of integer;
  st:array[1..3]of string;
  s:string;
  b:boolean;
begin
  readln(n);
  for i:=1 to n do
    begin
      fillchar(a,sizeof(a),0);
      for j:=1 to 3 do
        begin
          readln(st[j]);
          if st[j][11]='e'
            then begin
                   for k:=1 to 9 do
                     if st[j][k]<>' '
                       then a[ord(st[j][k])-64]:=2;
                 end;
        end;
      for j:=1 to 3 do
        begin
          for k:=1 to 4 do
            begin
              if (st[j][11]='u')and(a[ord(st[j][k])-64]=0)
                then a[ord(st[j][k])-64]:=1;
              if (st[j][11]='d')and(a[ord(st[j][k])-64]=0)
                then a[ord(st[j][k])-64]:=-1;
            end;
          for k:=6 to 9 do
            begin
              if (st[j][11]='u')and(a[ord(st[j][k])-64]=0)
                then a[ord(st[j][k])-64]:=-1;
              if (st[j][11]='d')and(a[ord(st[j][k])-64]=0)
                then a[ord(st[j][k])-64]:=1;
            end;
        end;
      for j:=1 to 12 do
        begin
          b:=false;
          if a[j]=1
            then begin
                   b:=true;
                   for k:=1 to 3 do
                     begin
                       if ((st[k][11]='u')and((pos(chr(j+64),st[k])=0)
                       or(pos(chr(j+64),st[k])>5)))
                       or ((st[k][11]='d')and((pos(chr(j+64),st[k])=0)
                       or(pos(chr(j+64),st[k])<5)))
                         then begin
                                b:=false;
                                break;
                              end;
                     end;
                 end;
          if a[j]=-1
            then begin
                   b:=true;
                   for k:=1 to 3 do
                     begin
                       if ((st[k][11]='u')and((pos(chr(j+64),st[k])=0)
                       or(pos(chr(j+64),st[k])<5)))
                       or ((st[k][11]='d')and((pos(chr(j+64),st[k])=0)
                       or(pos(chr(j+64),st[k])>5)))
                         then begin
                                b:=false;
                                break;
                              end;
                     end;
                 end;
          if b
            then begin
                   write(chr(j+64),' is the counterfeit coin and it is ');
                   if a[j]=1
                     then writeln('heavy.')
                     else writeln('light.');
                   break;
                 end;
        end;
    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