比赛 |
暑假培训七 |
评测结果 |
EEETTT |
题目名称 |
过河卒 |
最终得分 |
0 |
用户昵称 |
zpl123 |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-07-24 17:27:35 |
显示代码纯文本
program pj024;
const
horsex:array[1..8]of integer=(2,1,-1,-2,-2,-1,1,2);
horsey:array[1..8]of integer=(1,2,2,1,-1,-2,-2,-1);
var
flag:array[0..20,0..20]of boolean;
m,n,x,y,num:longint;
procedure ini;
begin
assign(input,'pj024.in');
reset(input);
assign(output,'pj024.out');
rewrite(output);
read(n,m,x,y);
close(input);
fillchar(flag,sizeof(flag),true);
end;
procedure work(x,y:longint);
begin
if (x=n)and(y=m) then inc(num);
if (x<n)and(flag[x+1,y]) then work(x+1,y);
if (y<m)and(flag[x,y+1]) then work(x,y+1);
end;
procedure main;
var
i:longint;
begin
flag[x,y]:=false;
for i:=1 to 8 do
if ((x+horsex[i])>=0) and ((x+horsex[i])<=n)
and ((y+horsey[i])>=0) and ((y+horsey[i])<=m) then
flag[x+horsex[i],y+horsey[i]]:=false;
work(0,0);
end;
procedure print;
begin
write(num);
close(output);
end;
begin
ini;
main;
print;
end.