记录编号 5181 评测结果 AAAAAAAAAA
题目名称 [NOIP 2002]过河卒 最终得分 100
用户昵称 GravatarOo湼鞶oO 是否通过 通过
代码语言 Pascal 运行时间 0.003 s
提交时间 2008-10-25 16:23:41 内存使用 0.17 MiB
显示代码纯文本
{*******************************************}
{* Program name: pj024                     *}
{* Input file: pj024.in                    *}
{* Output file: pj024.out                  *}
{* Date: 2008.10.25                        *}
{* Programmer: Peng Bo                     *}
{*******************************************}
program pj024;
type
 dt=array[-1..20,-1..20]of int64;
 pd=array[0..20,0..20]of boolean;
var
  s:dt;
  h:pd;
  f:text;
  n,m,x,y:byte;
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
procedure cs;
var
  j,k:shortint;
begin
  for j:=0 to n do
    for k:=0 to m do
      h[j,k]:=true;

  h[x,y]:=false;
  h[x-1,y-2]:=false;
  h[x-1,y+2]:=false;
  h[x+1,y-2]:=false;
  h[x+1,y+2]:=false;
  h[x-2,y-1]:=false;
  h[x-2,y+1]:=false;
  h[x+2,y-1]:=false;
  h[x+2,y+1]:=false;

  s[0,0]:=1;
  for j:=1 to n do
    s[j,-1]:=0;
  for k:=1 to m do
    s[-1,k]:=0;
end;{cs}
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
procedure main;
begin
  for x:=0 to n do
    for y:=0 to m do
    if (x<>0)or(y<>0)
    then
    begin
      if h[x,y]
      then
        s[x,y]:=s[x-1,y]+s[x,y-1]
      else
        s[x,y]:=0;
    end;
end;{main}
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
begin
  assign(f,'pj024.in');
  reset(f);
  read(f,n,m,x,y);
  close(f);
  {===========}
  cs;
  main;
  {===========}
  assign(f,'pj024.out');
  rewrite(f);
  write(f,s[n,m]);
  close(f);
end.