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

到底是1027还是1207……

Posted by 150014 at 2010-11-13 01:57:24 on Problem 1207
In Reply To:poj1027为什么WA??? Posted by:wyc4662 at 2010-11-12 23:33:28
> 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