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

哪位大哥看我那错了

Posted by crazyyangdan at 2011-05-30 14:16:27 on Problem 1207
#include<iostream>
using namespace std;
int main()
{   int i,j,s,t;
    while(cin>>i>>j)
    { int m,n;
       m=(i<j)?i:j;
       n=(i>j)?i:j;
      for(int k=m;k<=n;k++)
      { t=s=0;
       while(k!=1)
       { 
           if(k%2==0)   
          k=k/2; 
          else   k=3*k+1;
         s=s+1;
      }
      if(s>t) t=s;
     }
      cout<<i<<" "<<j<<" "<<t<<endl;
    }
   system("pause");
   return 0;
}

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