# 单挑女飞贼

303人阅读 评论(0)

[描述]

"站住！"
"

"

"

"

………………………………………………

"喂！你为什么可以动？？？"
"

"

"

[输入格式]

"0 0 0 0"为输入结束标志。

[输出格式]

[样例输入]

3   4

OXXO

XXOO

XOOO

3 2 2 4

3 3 1 1

0 0 0 0

[样例输出]

1

Impossible!

1s

[提示]

program li;
const
dx:array[1..4] of integer=(0,1,0,-1);
dy:array[1..4] of integer=(1,0,-1,0);
var
a,c:array[1..1000,1..1000]of char;
o:array[1..20000,1..3] of integer;
can:boolean;
procedure kuansou;
begin
o[1,1]:=x1; o[1,2]:=y1;  k:=0;  o[1,3]:=0;
repeat
for i:=1 to 4 do
begin
can:=true;
x:=xx+dx[i]; y:=yy+dy[i];
if ((x<1) or (x>n)) or ((y<1) or (y>m))or(a[x,y]='X') then can:=false;
if can then
begin
top:=top+1;
if a[x,y]='z' then begin writeln(o[top,3]); exit; end;
a[x,y]:='X';
end;
end;
end;
begin
ASSIGN(INPUT,'input.TXT');RESET(INPUT);
assign(output,'output.txt');
rewrite(output);
for i:=1 to n do
begin
for j:=1 to m do
end;
while (x1<>0)and(x2<>0)and(y1<>0)and(y2<>0) do
begin
for i:=1 to n do
for j:=1 to m do
a[i,j]:=c[i,j];
for i:=x2-1 downto 1 do
if a[i,y2]<>'X'then a[i,y2]:='z' else break;
for i:=x2+1 to n do
if a[i,y2]<>'X'then a[i,y2]:='z' else break;
for j:=y2-1 downto 1 do
if a[x2,j]<>'X'then a[x2,j]:='z' else break;
for j:=y2+1 to m do
if a[x2,j]<>'X'then a[x2,j]:='z' else break;
i:=x2;j:=y2;
repeat
i:=i+1; j:=j+1;
if (i>=1)and(i<=n)and(j>=1)and(j<=m)and(a[i,j]<>'X') then a[i,j]:='z' else break;
until (i<1)or(i>n)and(j<1)and(j>m);
i:=x2;j:=y2;
repeat
i:=i-1; j:=j-1;
if (i>=1)and(i<=n)and(j>=1)and(j<=m)and(a[i,j]<>'X') then a[i,j]:='z' else break;
until (i<1)or(i>n)and(j<1)and(j>m);
i:=x2;j:=y2;
repeat
i:=i+1; j:=j-1;
if (i>=1)and(i<=n)and(j>=1)and(j<=m)and(a[i,j]<>'X') then a[i,j]:='z' else break;
until (i<1)or(i>n)and(j<1)and(j>m);
i:=x2;j:=y2;
repeat
i:=i-1; j:=j+1;
if (i>=1)and(i<=n)and(j>=1)and(j<=m)and(a[i,j]<>'X') then a[i,j]:='z' else break;
until (i<1)or(i>n)and(j<1)and(j>m);
if a[x1,y1]='z' then writeln('0') else
begin
kuansou;
end;
end;
close(input);
close(output);
end.

0
0

* 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场
个人资料
• 访问：14850次
• 积分：106
• 等级：
• 排名：千里之外
• 原创：91篇
• 转载：0篇
• 译文：0篇
• 评论：0条
文章分类
文章存档
评论排行