Why I get WA? Pelase, help me!!!!!!! There is my solution: Program t1114; Const MaxL=15; Var Mas :array[1..20,0..MaxL,0..MaxL]of comp; Ans :comp; N,i,j,A,B,k :longint; u,v :longint; begin Read(N,A,B); for i:=1 to 20 do for j:=1 to MaxL do for k:=1 to MaxL do mas[i,j,k]:=0; if A>0 then mas[1,A-1,B]:=1; if B>0 then mas[1,A,B-1]:=1; if (A>0)and(B>0) then mas[1,A-1,B-1]:=1; mas[1,A,B]:=1; for i:=2 to N do begin for j:=0 to MaxL do for k:=0 to MaxL do if mas[i-1,j,k]<>0 then begin for u:=0 to j do for v:=0 to k do mas[i,j-u,k-v]:=mas[i,j-u,k-v]+mas[i-1,j,k]; end; end; Ans:=0; for i:=0 to MaxL do for j:=0 to MaxL do Ans:=Ans+mas[N,i,j]; writeln(Ans:0:0); end. Re: I misunderstand the problem! There is my AC solution: Program t1114; Const MaxL=15; Var Mas :array[1..20,0..MaxL,0..MaxL]of extended; Ans :extended; N,i,j,A,B,k :longint; u,v :longint; begin Read(N,A,B); for i:=1 to 20 do for j:=1 to MaxL do for k:=1 to MaxL do mas[i,j,k]:=0; for u:=0 to A do for v:=0 to B do mas[1,A-u,B-v]:=1; for i:=2 to N do for j:=0 to MaxL do for k:=0 to MaxL do if mas[i-1,j,k]<>0 then for u:=0 to j do for v:=0 to k do mas[i,j-u,k-v]:=mas[i,j-u,k-v]+mas[i-1,j,k]; Ans:=0; for i:=0 to MaxL do for j:=0 to MaxL do Ans:=Ans+mas[N,i,j]; writeln(Ans:0:0); end. |