|
|
вернуться в форумIt's IMPOSSIBLE!!! WA!!! I think this's right !!! 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 !!! Послано Dim 16 апр 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 !!! |
|
|