|
|
вернуться в форумWhy "Wong answer"? can anyone tell me why i got wa? program Maximum; var t:array[0..100000] of longint; x,max:longint; b:byte; begin t[0]:=0; t[1]:=1; for x:=2 to 100000 do begin b:=(b+1) mod 2; if b=0 then t[x]:=t[x div 2]+t[(x div 2) +1] else t[x]:=t[x div 2]; end; for x:=0 to 100000 do if t[x]>max then max:=t[x] else t[x]:=max; readln(x); while x>0 do begin writeln(t[x]); readln(x); end; end.
|
|
|