/*************************************************************************
File Name: 10322.cpp
Author: yubo
Mail: yuzibode@126.com
Created Time: 2014年04月10日 星期四 07时22分26秒
学习重点:没有比较大小,导致WR了一次
************************************************************************/
#include
#include
#include
#include
using namespace std; int s[1000010]; void sum(int a,int b) { int i,j,t,k,n; i=a; n=0; for(;i<=b;i++,n++){ k=0; t=i; while(t!=1){ if(t%2==0){ t/=2; k++; } else{ t=3*t+1; k++; } } s[n]=k+1; } sort(s,s+n); printf("%d",s[n-1]); } int main() { int a,b,t; while(scanf("%d%d",&a,&b)==2){ printf("%d %d ",a,b); if(a>b) { t=a; a=b; b=t; } sum(a,b); printf("\n"); } }