Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么会WA?????In Reply To:陷阱!!!! Posted by:00448217 at 2005-08-14 10:19:06 var i,n,m,ans,t,max:longint; b:boolean; begin while not eof do begin read(n,m); b:=false; if n>m then begin t:=n; n:=m; m:=t; b:=true; end; max:=0; for i:=n to m do begin t:=i; ans:=1; while t>1 do begin if odd(t) then t:=t*3+1 else t:=t div 2; ans:=ans+1; end; if ans>max then max:=ans; end; if b then writeln(m,' ',n,' ',max) else writeln(n,' ',m,' ',max) end; end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator