记录编号 4344 评测结果 AAAWWA
题目名称 [NOIP 2002]过河卒 最终得分 66
用户昵称 Gravatarrottenwood 是否通过 未通过
代码语言 Pascal 运行时间 0.001 s
提交时间 2008-10-17 20:58:28 内存使用 0.12 MiB
显示代码纯文本
program pj024;
const
s1:array [1..8] of integer=(-2,-1,1,2,2,1,-1,-2);
s2:array [1..8] of integer=(-1,-2,-2,-1,1,2,2,1);
var
a:array [-1..21,-1..21] of int64;
i,j,m,n,x,y,c,d:longint;
f1,f2:text;
begin
assign(f1,'pj024.in');reset(f1);
assign(f2,'pj024.out');rewrite(f2);
fillchar(a,sizeof(a),0);
a[0,0]:=1;
readln(f1,m,n,x,y);
a[x,y]:=-1;
for i:=1 to 8 do
begin
c:=x+s1[i];
d:=y+s2[i];
if (c>-1)and(c<=m)and(d>-1)and(d<=n) then a[c,d]:=-1;
end;
for i:=0 to m do
for j:=0 to n do
if (a[i,j]<>-1) then
begin
if (i-1>=0) and (a[i-1,j]<>-1) then a[i,j]:=a[i,j]+a[i-1,j];
if (j-1>=0) and (a[i,j-1]<>-1) then a[i,j]:=a[i,j]+a[i,j-1];
end;
writeln(f2,a[m,n]);
close(f2);
end.