记录编号 6642 评测结果 AAAWWA
题目名称 [NOIP 2002]过河卒 最终得分 66
用户昵称 Gravatarelysian 是否通过 未通过
代码语言 Pascal 运行时间 0.032 s
提交时间 2008-11-03 20:26:05 内存使用 0.12 MiB
显示代码纯文本
program elysian;   
const  
fin='pj024.in';fout='pj024.out';   
mx:array[0..8] of integer=(0,2,1,-1,-2,-2,-1,1,2);   
my:array[0..8] of integer=(0,1,2,2,1,-1,-2,-2,-1);   
var  
f:array[-2..20,-2..20] of qword;   
flag:array[-2..20,-2..20] of boolean;   
n,m,x,y:longint;   
f1,f2:text;   
  
procedure main;   
var  
i,j,t1,t2:longint;   
begin  
for i:=1 to n do  
for j:=1 to m do  
begin  
if flag[i,j]=false then f[i,j]:=f[i-1,j]+f[i,j-1];   
end;   
  
assign(f2,fout);rewrite(f2);   
writeln(f2,f[n,m]);   
close(f2);   
end;   
  
procedure init;   
var  
i:longint;   
begin  
assign(f1,fin);reset(f1);   
readln(f1,n,m,x,y);   
close(f1);   
for i:=0 to 8 do  
 begin  
 flag[x+mx[i],y+my[i]]:=true;f[x+mx[i],y+my[i]]:=0;   
 end;   
 f[0,0]:=1;   
 for i:=1 to m do if flag[0,i]=false then f[0,i]:=f[0,i-1];   
 for i:=1 to n do if flag[i,0]=false then f[i,0]:=f[i-1,0];   
end;   
  
begin  
init;   
main;   
end.