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

poj1027为什么WA???

Posted by wyc4662 at 2010-11-12 23:33:28 on Problem 1207
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:
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