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 |
1207 1AC PASCALfunction pa(n:longint):longint; var len:longint; begin len:=1; while n<>1 do begin if odd(n) then n:=n*3+1 else n:=n div 2; inc(len); end; pa:=len; end; var n,m,tmp,tn,tm,i,max,j:longint; a:boolean; begin while not eof do begin a:=true; readln(n,m); tn:=n; tm:=m; max:=-1; if n>m then begin a:=false;tmp:=n;n:=m;m:=tmp; end; for i:=n to m do begin j:=pa(i); if max<j then max:=j; end; writeln(tn,' ',tm,' ',max); end; end. 顶起PASCAL!!! Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator