|  | 
|  | 
| back to board | Who can tell me why I got WA? Posted by Celeron  29 Nov 2002 08:34Program 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 ! Hi CeleronDO 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:18Var 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! Const A:Array[1..4]Of LongInt=(10,670,55252,4816030);Var N:Byte;BeginRead(N);Write(A[N Div 2])End.
 
 
 99 characters :-)
 | 
 | 
|