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

Whi I got WA? please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!??????????????????????!!!!!!!!!!!!!!!!!!!!???????????!!!!!!!!!?!!!!!
Posted by I am david. Tabo. 5 Feb 2002 23:36
Whi i got WA!!!!!!!!!!!!!!!!?????????????!!!!!!!!!!!??????
var t,i,j,m,k,l,n,max:longint;
    a:array [1..10] of longint;
    b:array [0..1000000] of longint;
begin
  readln (t);
  if t=0 then
    halt;
  b[0]:=0;
  b[1]:=1;
  for m:=1 to t do
    begin
      b[2*m]:=b[m];
      b[2*m+1]:=b[m]+b[m+1];
    end;
  max:=b[0];
  for m:=0 to t do
    if b[m]>max then
      max:=b[m];
  writeln (max);
end.
Re: Whi I got WA? please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!??????????????????????!!!!!!!!!!!!!!!!!!!!???????????!!!!!!!!!?!!!!!
Posted by Tomasz Klos 6 Feb 2002 00:25
your program should read input as long as t>0
just add several lines:

begin
readln(t);
while t>0 do begin
...
...
writeln(max);
readln(t);
end;
end.

and you'll get accepted
Re: Whi I got WA? please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!??????????????????????!!!!!!!!!!!!!!!!!!!!???????????!!!!!!!!!?!!!!!
Posted by zyzyis 27 Mar 2002 08:44
not yet,it will waste too many memory,and it can't
be finished in time when i input 10 number like this
99999
99998
99997
99996
99995
...



> your program should read input as long as t>0
> just add several lines:
>
> begin
> readln(t);
> while t>0 do begin
> ...
> ...
> writeln(max);
> readln(t);
> end;
> end.
>
> and you'll get accepted
Re: Whi I got WA? please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!??????????????????????!!!!!!!!!!!!!!!!!!!!???????????!!!!!!!!!?!!!!!
Posted by Seraph 31 Mar 2003 20:43
maybe you can use one more array to store the result
> not yet,it will waste too many memory,and it can't
> be finished in time when i input 10 number like this
> 99999
> 99998
> 99997
> 99996
> 99995
> ...
>
>
>
> > your program should read input as long as t>0
> > just add several lines:
> >
> > begin
> > readln(t);
> > while t>0 do begin
> > ...
> > ...
> > writeln(max);
> > readln(t);
> > end;
> > end.
> >
> > and you'll get accepted