1
已解决
程思怡
中级守护
中级守护
const
dir:array [1..4,1..2] of longint= (
(0,-1),(0,1),(-1,1),(1,1)
);
var
map:array[0..10,0..10] of longint;
flag:array[0..10,0..10] of boolean;
i,n,m,t,sx,sy,fx,fy,count,a,b,j:longint;
procedure drs(x,y:longint);
var
i,nx,ny:longint;
begin
if (x=fx) and (y=fy) then
begin
inc(count);
exit;
end;
for i:=1 to 4 do
begin
nx:=x+dir[i,1];
ny:=y+dir[i,2];
if (nx>=1) and (nx<=n) and (ny>=1) and (ny<=m)
and (map[nx,ny]=0)
and (not flag[nx,ny]) then
begin
flag[nx,ny]:=true;
drs(nx,ny);
flag[nx,ny]:=false;
end;
end;
end;
begin
read(n,m,t);
read(sx,sy,fx,fy);
fillchar(map,sizeof(map),0);
{for i:=1 to n do
for j:=1 to m do map[i,j]:=0;}
fillchar(flag,sizeof(flag),false);
count:=0;
for i:=1 to t do
begin
read(a,b);
map[a,b]:=1;
flag[a,b]:=true;
end;
{for i:=1 to n do begin
for j:=1 to m do write(map[i,j]);
writeln;
end;}
flag[sx,sy]:=true;
drs(sx,sy);
write(count);
end.
麻烦各位大神帮忙看看