记录编号 1352 评测结果 AAAWWA
题目名称 [NOIP 2002]过河卒 最终得分 66
用户昵称 Gravatar打不死的羊 是否通过 未通过
代码语言 Pascal 运行时间 0.002 s
提交时间 2008-09-01 21:30:07 内存使用 0.12 MiB
显示代码纯文本
program pj024;
Type
fxz=array[0..21,0..21] of real;
var
a:fxz;
i,j,x,y,n,m:longint;
f1,f2:text;
begin
assign(f1,'pj024.in');
assign(f2,'pj024.out');
reset(f1);rewrite(f2);
readln(f1,n,m,x,y);
for i:=1 to n do
for j:=1 to m do
a[i,j]:=0;
a[x,y]:=-1;
if (x+2<=n)and(y+1<=m) then a[x+2,y+1]:=-1;
if (x+2<=n)and(y-1>=0) then a[x+2,y-1]:=-1;
if (x+1<=n)and(y+2<=m) then a[x+1,y+2]:=-1;
if (x+1<=n)and(y-2>=0) then a[x+1,y-2]:=-1;
if (x-2>=0)and(y+1<=m) then a[x-2,y+1]:=-1;
if (x-2>=0)and(y-1>=0) then a[x-2,y-1]:=-1;
if (x-1>=0)and(y+2<=m) then a[x-1,y+2]:=-1;
if (x-1>=0)and(y-2>=0) then a[x-1,y-2]:=-1;
a[0,0]:=1;
for i:=0 to n do
for j:=0 to m do
begin
if a[i,j]>0 then begin if a[i,j+1]>-1 then a[i,j+1]:=a[i,j]+a[i,j+1];
                       if a[i+1,j]>-1 then a[i+1,j]:=a[i,j]+a[i+1,j];
                 end;
end;
writeln(f2,a[n,m]:0:0);
close(f1);close(f2);
end.