比赛 |
暑假培训七 |
评测结果 |
AAATTT |
题目名称 |
过河卒 |
最终得分 |
30 |
用户昵称 |
苏轼 |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-07-24 16:40:50 |
显示代码纯文本
program pj024;
var qp:array[0..20,0..20]of boolean;
n,m,x,y,ans:word;
f:text;
procedure ss(x,y:word);
var i:word;
begin
if (x=n)and(y=m) then
inc(ans);
if (x>=0)and(x<=n)and(y>=0)and(y<=m)and(not(qp[x,y])) then
for i:=1 to 2 do
case i of
1:ss(x+1,y);
2:ss(x,y+1);
end;
end;
begin
assign(f,'pj024.in');
reset(f);
readln(f,n,m,x,y);
close(f);
qp[x,y]:=true;
if (x+2<=n)and(y+1<=m) then {P1~P8}
qp[x+2,y+1]:=true;
if (x+1<=n)and(y+2<=8) then
qp[x+1,y+2]:=true;
if (x-1>=0)and(y+2<=m) then
qp[x-1,y+2]:=true;
if (x-2>=0)and(y+1<=m) then
qp[x-2,y+1]:=true;
if (x-2>=0)and(y-1<=m) then
qp[x-2,y-1]:=true;
if (x-1>=0)and(y-2<=m) then
qp[x-1,y-2]:=true;
if (x+1<=n)and(y-2>=0) then
qp[x+1,y-2]:=true;
if (x+2<=n)and(y-1>=0) then
qp[x+2,y-1]:=true;
ss(0,0);
assign(f,'pj024.out');
rewrite(f);
writeln(f,ans);
close(f);
end.