|
|
вернуться в форумWhi I got WA? please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!??????????????????????!!!!!!!!!!!!!!!!!!!!???????????!!!!!!!!!?!!!!! 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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!??????????????????????!!!!!!!!!!!!!!!!!!!!???????????!!!!!!!!!?!!!!! 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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!??????????????????????!!!!!!!!!!!!!!!!!!!!???????????!!!!!!!!!?!!!!! Послано zyzyis 27 мар 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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!??????????????????????!!!!!!!!!!!!!!!!!!!!???????????!!!!!!!!!?!!!!! Послано Seraph 31 мар 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 |
|
|