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

这么简单的都WA

Posted by JiangLY at 2005-05-01 17:43:56 on Problem 1573
哪里错了?
var
  map:array[1..10,1..10] of char;
  way:array[1..10,1..10] of boolean;
  step:array[1..10,1..10] of integer;
  n,m,g,i,j,l,x,y:integer;
begin
  readln(n,m,g);
  while (n<>0)or(m<>0)or(g<>0) do
    begin
      fillchar(map,sizeof(map),0);
      for i:=1 to n do
        begin
          for j:=1 to m do read(map[i,j]);
          readln;
        end;
      fillchar(way,sizeof(way),false);
      fillchar(step,sizeof(step),0);
      l:=0;
      x:=1;
      y:=g;
      way[x,y]:=true;
      repeat
        inc(l);
        case map[x,y] of
          'N':dec(x);
          'S':inc(x);
          'W':dec(y);
          'E':inc(y);
        end;
        if way[x,y] then
          begin
            writeln(step[x,y],' step(s) before a loop of ',l-step[x,y],' step(s)');
            break;
          end;
        if (x=0)or(y=0) then
          begin
            writeln(l,' step(s) to exit');
            break;
          end;
        step[x,y]:=l;
        way[x,y]:=true;
      until false;
    readln(n,m,g);
  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