记录编号 6539 评测结果 AAAWWA
题目名称 [NOIP 2002]过河卒 最终得分 66
用户昵称 Gravatar王瑞祥K 是否通过 未通过
代码语言 Pascal 运行时间 0.000 s
提交时间 2008-11-02 23:37:50 内存使用 0.12 MiB
显示代码纯文本
program pj024(input,output);
const
 dx:array[1 .. 8] of shortint = (-2,-1,1,2,2,1,-1,-2);
 dy:array[1 .. 8] of shortint = (1,2,2,1,-1,-2,-2,-1);
var
 n,m,x,y,i,j: Byte;
 g:array[0..20,0..20] of byte;
 f:array[0..20,0..20] of comp;
begin
 assign(input,'pj024.in');assign(output,'pj024.out');
 reset(input);rewrite(output);
 readln(n,m,x,y);
 fillchar(g,sizeof(g),0);
 g[x, y]:=1;
 for i:=1 to 8 do
  if (x+dx[i]>=0)and(x+dx[i]<=n)and(y+dy[i]>=0)and(y+dy[i]<=m)then
  g[x+dx[i],y+dy[i]]:=1;
 f[0,0]:=1;
 for i:=1 to n do
  if g[i,0]=0 then f[i,0]:=f[i-1,0];
 for i := 1 to m do
  if g[0,i]=0 then f[0,i]:=f[0,i-1];
 for i := 1 to n do
  for j := 1 to m do
   if g[i,j]=0 then f[i,j]:=f[i-1,j]+f[i,j-1];
 write(f[n,m]:0:0);
end.