|
|
back to boardwhy I get WA(3)????Help me!!!! Posted by zhl 8 Jan 2009 08:24 program p1079; var a:array[0..100000] of longint; m:array[1..100000] of longint; n,max,i:longint; begin max:=1; a[1]:=1; m[1]:=1; readln(n); while n<>0 do begin if n<=max then writeln(m[n]) else begin for i:=max+1 to n do begin if odd(i) then a[i]:=a[i div 2]+a[i div 2+1] else a[i]:=a[i div 2]; if a[i]>=m[i-1] then m[i]:=a[i] else m[i]:=m[i-1]; end; end; writeln(m[n]); readln(n); end; end. Re: why I get WA(3)????Help me!!!! test: 1 2 3 0 right answer is: 1 1 2 Good luck)) Re: why I get WA(3)????Help me!!!! Urraaa... Accepted ...!!! Good test.Thank you very much (apple_worm)...!!! |
|
|