- 古韵之鹊桥相会
- 2009-05-26 23:13:51 @
program P1406;
const
Limit=20;
dx:array[1..4]of shortint=(-1,1,0,0);
dy:array[1..4]of shortint=(0,0,-1,1);
var
map:array[1..Limit,1..Limit]of char;
canuse:array[1..Limit,1..Limit]of boolean;
num:array[1..Limit,1..Limit]of integer;
d:array[1..500,1..2]of integer;
g:array[1..400,1..400]of shortint;
pos,m,n:integer;
procedure init;
var
i,j:integer;
begin
readln(m,n);
for i:=1 to m do
begin
for j:=1 to n do
read(map);
readln;
end;
pos:=0;
for i:=1 to m do
for j:=1 to n do
begin
canuse:=true;
g:=maxint;
end;
end;
procedure bfs(p,q:integer);
var
t,w,x,y,i:integer;
begin
inc(pos);
num[p,q]:=pos;
t:=1; w:=1; d[t,1]:=p; d[t,2]:=q;
canuse[p,q]:=false;
repeat
for i:=1 to 4 do
begin
x:=d[t,1]+dx[i];
y:=d[t,2]+dy[i];
if (x>=1)and(y>=1)and(x=1)and(y>=1)and(x