Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

太坑了!!F---CK! i可以小于j!! 为以后童鞋提供代码(pascal)16MS~~

Posted by zyx980506 at 2010-04-05 21:59:37 on Problem 1207
var i,j,k,x,y,z,tot,rj,rk:longint;
begin
  j:=1;k:=2;
  while not eof do begin
  readln(j,k);
  rj:=j;rk:=k;
  z:=0;
  if j>k then begin
    x:=j;j:=k;k:=x;
  end;
  for i:=j to k do begin
    tot:=1;x:=i;
    while x<>1 do begin
      inc(tot);
      if odd(x)then x:=x*3+1 else x:=x div 2;
    end;
    if tot>z then z:=tot;
  end;
  writeln(rj,' ',rk,' ',z);
  end;
end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator