/ Vijos / 讨论 / 问答 /

马拦卒过河,只过6个点,帮忙看看

program p1121;

var n,m,bx,by,i,j:integer;

a:array[-2..17,-2..17]of integer;

b:array[1..2,1..8]of integer=((1,2,-1,-2,1,2,-1,-2),(2,1,-2,-1,-2,-1,2,1));

f:array[-2..17,-2..17]of integer;

begin

read(bx,by,n,m);

f[0,0]:=1;

fillchar(a,sizeof(a),0);

fillchar(f,sizeof(f),0);

a[n,m]:=1;

for i:=1 to 8 do

a[n+b[1,i],m+b[2,i]]:=1;

for i:=0 to bx do

for j:=0 to by do

if (a=0) then

begin

f:=f+f;

f[0,0]:=1;

end;

write(f[bx,by]);

end.

2 条评论

  • @ 2010-03-11 17:12:45

    找到原因了,把integer改成longint就过了,汗

  • @ 2010-03-10 20:25:40

    XM

    var n,m,bx,by,i,j:integer;

       a:array[-2..17,-2..17]of integer;

       b:array[1..2,1..8]of integer=((1,2,-1,-2,1,2,-1,-2),(2,1,-2,-1,-2,-1,2,1));

       f:array[-2..17,-2..17]of integer;

    !~~同学你的b数组应该放在const的后面吧

  • 1