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

Why "Wong answer"?
Posted by Adam Alz Rutkowski 25 Jan 2003 21:44
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.