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 1044. Lucky Tickets. Easy!

Filippov Nickolas SSAU#2's AC program is HERE!
Posted by Nickolas 20 Feb 2003 19:38
program luckytickets;
 var a:array[0..36] of longint;
     i,j,k:integer;
     n:integer;
     chislo:longint;
begin
  readln(n);
  fillchar(a,sizeof(a),0);
  if n mod 2 = 1 then writeln(1) else
  begin
    for i:=0 to 9 do a[i]:=1;
      for i:=2 to (n div 2)  do
      for k:=i*9 downto 0 do begin
        chislo:=0;
          for j:=0 to 9 do
      if (k-j)>=0 then chislo:=chislo+a[k-j];
        a[k]:=chislo;
      end;
    chislo:=0;
    for i:=0 to (n div 2)*9 do chislo:=chislo+a[i]*a[i];
    writeln(chislo);
  end;
end.
Re: Filippov Nickolas SSAU#2's AC program is HERE!
Posted by Kurnia Wijanto 23 May 2003 09:48
> program luckytickets;
>  var a:array[0..36] of longint;
>      i,j,k:integer;
>      n:integer;
>      chislo:longint;
> begin
>   readln(n);
>   fillchar(a,sizeof(a),0);
>   if n mod 2 = 1 then writeln(1) else
>   begin
>     for i:=0 to 9 do a[i]:=1;
>       for i:=2 to (n div 2)  do
>       for k:=i*9 downto 0 do begin
>         chislo:=0;
>           for j:=0 to 9 do
>       if (k-j)>=0 then chislo:=chislo+a[k-j];
>         a[k]:=chislo;
>       end;
>     chislo:=0;
>     for i:=0 to (n div 2)*9 do chislo:=chislo+a[i]*a[i];
>     writeln(chislo);
>   end;
> end.
>
Is this solution Dynamic Programming?
Posted by Fujii Hironori 31 May 2003 16:03