记录编号 9202 评测结果 AAAAAA
题目名称 [NOIP 2002]过河卒 最终得分 100
用户昵称 Gravatar苏轼 是否通过 通过
代码语言 Pascal 运行时间 0.052 s
提交时间 2009-03-02 19:59:59 内存使用 0.12 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.