ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1114. Boxes

who can help me? i got WA!!!!!
Posted by ACer 17 Aug 2003 16:04
var
 n,a,b:integer;
 p:array[0..20,0..15,0..15]of extended;
procedure init;
var
 i,j:integer;
begin
 read(n);
 read(a);
 read(b);

 fillchar(p,sizeof(p),0);
 for i:=0 to a do
  for j:=0 to b do
   p[0,i,j]:=1;
 for i:=0 to n do p[i,0,0]:=1;

end;
procedure solve(n,a,b:integer);
var
 i,j:integer;
begin
 if n>=1 then
  for i:=0 to a do
   for j:=0 to b do
    begin
     if p[n-1,i,j]=0 then
      solve(n-1,i,j);
     p[n,a,b]:=p[n,a,b]+p[n-1,i,j];
    end;
end;
begin
 init;
 solve(n,a,b);
 writeln(p[n,a,b]:0:0);
end.