记录编号 1389 评测结果 AAAWWA
题目名称 [NOIP 2002]过河卒 最终得分 66
用户昵称 Gravatar苏轼 是否通过 未通过
代码语言 Pascal 运行时间 0.002 s
提交时间 2008-09-01 22:27:18 内存使用 0.14 MiB
显示代码纯文本
program cch(input,output);
var
 a:array[0..50,0..50] of boolean;
 b:array[0..50,0..50] of int64;
 i,j,n,m,x,y:integer;
begin
 assign(input,'pj024.in');
 assign(output,'pj024.out');
 reset(input);
 rewrite(output);
 readln(n,m,x,y);
 for i:=0 to n do
  for j:=0 to m do
   begin
    a[i,j]:=true;
    b[i,j]:=0;
   end;
 {for i:=0 to n do b[i,0]:=1;
 for i:=0 to m do b[0,i]:=1;}
 a[x-2,y+1]:=false; a[x-1,y+2]:=false; a[x+1,y+2]:=false;
 a[x+2,y+1]:=false; a[x+2,y-1]:=false; a[x+1,y-2]:=false;
 a[x-1,y-2]:=false; a[x-2,y-1]:=false; a[x,y]:=false;
 {b[x-2,y+1]:=0; b[x-1,y+2]:=0; b[x+1,y+2]:=0;
 b[x+2,y+1]:=0; b[x+2,y-1]:=0; b[x+1,y-2]:=0;
 b[x-1,y-2]:=0; b[x-2,y-1]:=0; b[x,y]:=0;}
 b[0,0]:=1;
 for i:=0 to m do
  for j:=0 to n do
   if a[j,i] then
    begin
     if (i=0)and(j<>0) then b[j,i]:=b[j-1,i];
     if (j=0)and(i<>0) then b[j,i]:=b[j,i-1];
     if (j<>0)and(i<>0) then b[j,i]:=b[j-1,i]+b[j,i-1];
    end;
 writeln(b[n,m]);
 close(input);
 close(output);
end.