///@date 9/26/2017
///@author Sycamore
///@link http://acm.hdu.edu.cn/showproblem.php?pid=1032
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int a,b;
while(cin>>a>>b)
{
bool shit=false;
if(a>b)
{
swap(a,b);
shit=true;
}
int ans=0;
for(int i=a;i<=b;i++)
{
int n=i;
int cnt=1;
while(n!=1)
{
cnt++;
if(n&1)n=3*n+1;
else n>>=1;
}
ans=max(ans,cnt);
}
if(shit)cout<<b<<' '<<a<<' '<<ans<<endl;
else cout<<a<<' '<<b<<' '<<ans<<endl;
}
}
转载于:https://www.cnblogs.com/zjnu/p/7598817.html