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!

Who can tell me why I got WA?
Posted by Celeron 29 Nov 2002 08:34
Program ural1044;
Var
  i,j,k,n,Res:Longint;
  f:Array[1..4,0..36] of Longint;

Begin
  fillchar(f,sizeof(f),0);
  For i:=0 To 9 Do f[1,i]:=1;
  For i:=1 To 3 Do
    For j:=0 To 9 Do
      For k:=0 To 9 Do
        Inc(f[i+1,j+k],f[i,j]);
  ReadLn(n);
  Res:=0;
  For i:=0 To (n div 2)*9 Do
    Inc(Res,sqr(f[n div 2,i]));
  WriteLn(Res);
End.
! answer to you and all about this problem !
Posted by Locomotive 25 Dec 2002 21:15
Hi Celeron
DO you still have problem???
i can help you
i think it is because you count this number as a 6digits number

     087366
(are you notice about zeroes at first digit???)
(they are very important)
test your problem with this
Var
  b                   :byte;
begin
  readln(b);
  b:=b div 2;
  case b of
    1:  writeln(10);
    2:  writeln(670);
    3:  writeln(55252);
    4:  writeln(4816030);
  end;
end.

Sincerely
Aidin_n7@hotmail.com
or this
Posted by Oleg 6 Jan 2003 08:18
Var b:byte;begin read(b);case b of 2:writeln(10); 4:writeln(670);
6:writeln(55252); 8:writeln(4816030);end;end.

my code shortest
no it's not the shortest :-) here is a shorter one!
Posted by Oxox Xoxov 5 May 2003 04:28
Const A:Array[1..4]Of LongInt=(10,670,55252,4816030);Var N:Byte;Begin
Read(N);Write(A[N Div 2])End.


99 characters :-)