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

你的程序里一个判数组越界的if都没有,而越界的情况显然存在.

Posted by xfxyjwf at 2005-08-16 21:16:56 on Problem 1111
In Reply To:求助!!! Posted by:Racion at 2005-08-16 20:19:42
> 这是我的程序:
> Program ZJU1047;
> Var
>    map:array[0..80,0..80]of char;
>   a,b,c,d,i,j,k:Longint;
> Label 1;
> Procedure Change(c,d:Longint);
> Begin
>      if map[c,d+1]='X' then Begin map[c,d+1]:='0';Change(c,d+1);end;
>      if map[c,d-1]='X' then Begin map[c,d-1]:='0';Change(c,d-1);end;
>      if map[c+1,d]='X' then Begin map[c+1,d]:='0';Change(c+1,d);end;
>      if map[c-1,d]='X' then Begin map[c-1,d]:='0';Change(c-1,d);end;
>      if map[c+1,d+1]='X' then Begin map[c+1,d+1]:='0';Change(c+1,d+1);end;
>      if map[c-1,d+1]='X' then Begin map[c-1,d+1]:='0';Change(c-1,d+1);end;
>      if map[c+1,d-1]='X' then Begin map[c+1,d-1]:='0';Change(c+1,d-1);end;
>      if map[c-1,d-1]='X' then Begin map[c-1,d-1]:='0';Change(c-1,d-1);end;
> end;
> Procedure Init;
> Begin
>      Fillchar(map,sizeof(map),'.');
>      readln(a,b,c,d);
>      if (a=0)and(b=0)and(c=0)and(d=0)then halt;
>      For i:=1 to a do map[i,b+2]:='A';
>      For i:=1 to b do map[a+2,i]:='A';
>      For i:=1 to a do Begin
>          For j:=1 to b do
>              Read(map[i,j]);
>          Readln;
>      End;
> End;
> Procedure Click;
> Begin
>      map[c,d]:='0';
>      Change(c,d);
> end;
> Procedure Count;
> Begin
>      For i:=0 to a+1 do
>          For j:=0 to b+1 do
>              if (map[i,j]<>'0') {and (map[i,j]<>'A')} and((map[i+1,j]='0')or(map[i-1,j]='0')or(map[i,j+1]='0')
>              or(map[i,j-1]='0')) then map[i,j]:='Q';
> 
>          End;
> Begin
> 1:   k:=0;
>      INit;
>      Click;
>      Count;
>      For i:=0 to a+1 do
>          For j:=0 to b+1 do if map[i,j]='Q' then
>          Begin
>          If map[i,j+1]='0' then inc(k);
>          If map[i,j-1]='0' then inc(k);
>          If map[i+1,j]='0' then inc(k);
>          If map[i-1,j]='0' then inc(k);
>          end;
>      Writeln(k);goto 1;
> End.
> 
> 请教各位高手,为何会出现Range Check Error??谢谢!

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