记录编号 | 3642 | 评测结果 | AAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | [NOIP 2002]过河卒 | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | Pascal | 运行时间 | 0.003 s | ||
提交时间 | 2008-10-08 20:15:08 | 内存使用 | 0.17 MiB | ||
Program pj024; Type sc=array [-2..20,-2..20] of int64; sc1=array [0..20,0..20] of boolean; Var n,m,x,y:integer; a:sc1; s:sc; i,j:integer; Begin assign(input,'pj024.in'); assign(output,'pj024.out'); reset(input); rewrite(output); read(n,m,x,y); for i:=0 to n do for j:=0 to m do begin a[i,j]:=true; s[i,j]:=0; end; a[x,y]:=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+2,y+1]:=false; if (n-1>=0) and (a[n-1,m]=true) then s[n-1,m]:=1; if (m-1>=0) and (a[n,m-1]=true) then s[n,m-1]:=1; for i:=n downto 0 do begin for j:=m downto 0 do begin if (i-1>=0) then if a[i-1,j]=true then s[i-1,j]:=s[i-1,j]+s[i,j]; if (j-1>=0) then if a[i,j-1]=true then s[i,j-1]:=s[i,j-1]+s[i,j]; end; end; write(s[0,0]); close(input); close(output); End.