记录编号 15079 评测结果 AAAWWA
题目名称 [NOIP 2002]过河卒 最终得分 66
用户昵称 Gravatarbing 是否通过 未通过
代码语言 Pascal 运行时间 0.002 s
提交时间 2009-11-09 18:07:34 内存使用 0.14 MiB
显示代码纯文本
program bing;
const
 gx:array[1..8] of integer=(-2,-1,1,2,2,1,-1,-2);
 gy:array[1..8] of integer=(-1,-2,-2,-1,1,2,2,1);
var
 f1,f2:text;
 n,m,x,y:longint;
 a:array[0..50,0..50] of int64;
 b:array[0..50,0..50] of boolean;
 i,j:longint;
begin
 assign(f1,'pj024.in');reset(f1);
 assign(f2,'pj024.out');rewrite(f2);
 readln(f1,n,m,x,y);
 fillchar(b,sizeof(b),true);
 fillchar(a,sizeof(a),0);
 b[x,y]:=false;
 for i:=1 to 8 do
  if (x+gx[i]>=0)and(x+gx[i]<=n)and(y+gy[i]>=0)and(y+gy[i]<=m) then
  b[x+gx[i],y+gy[i]]:=false;
 a[0,0]:=1;
 for i:=1 to m do
 if b[0,i] then a[0,i]:=a[0,i-1];
 for i:=1 to n do
 if b[i,0] then a[i,0]:=a[i-1,0];
 for i:=1 to n do
 for j:=1 to m do
 if b[i,j] then
  a[i,j]:=a[i-1,j]+a[i,j-1];
 writeln(f2,a[n,m]);
 close(f1);close(f2);
end.