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 1079. Maximum

It's IMPOSSIBLE!!! WA!!! I think this's right !!!
Posted by Duplyakin 11 Apr 2003 19:02
This is my  solution.
--------------------------------------------------------------------------
var N,i,k,Max:longint; M:array [0..32000] of integer;
BEGIN
  Read(N);
  Repeat
     M[0]:=0; M[1]:=1; Max:=1;
     For i:=2 to N do
     Begin
       If i mod 2=0 then M[i]:=M[i div 2]
                    else M[i]:=M[(i-1) div 2]+M[(i-1) div 2+1];
       If M[i]>Max then Max:=M[i];
     End;
 Write(Max);
  Read(N);
  Until N=0;
END.
--------------------------------------------------------------------------
Help me, please !!!
       Where's MISTAKE !!!
                Write me or give some tests !!!
                              Thank you !!!
Re: It's IMPOSSIBLE!!! WA!!! I think this's right !!!
Posted by Dim 16 Apr 2003 16:49
> This is my  solution.
> --------------------------------------------------------------------
------
> var N,i,k,Max:longint; M:array [0..100005] of integer;
> BEGIN
>   Read(N);
>   Repeat
>      M[0]:=0; M[1]:=1; Max:=1;
>      For i:=2 to N do
>      Begin
>        If i mod 2=0 then M[i]:=M[i div 2]
>                     else M[i]:=M[(i-1) div 2]+M[(i-1) div 2+1];
>        If M[i]>Max then Max:=M[i];
>      End;
>  Write(Max);
>   Read(N);
>   Until N=0;
> END.
> --------------------------------------------------------------------
------
> Help me, please !!!
>        Where's MISTAKE !!!
>                 Write me or give some tests !!!
>                               Thank you !!!