Read post
#include<iostream>
using namespace std;
int main()
{
long long a,b,c,d,e,f;
long long i;
int sum,sum1;
sum=1;
while(cin>>a>>b)
{ e=a;
f=b;
if(a>b)
{d=a;
a=b;
b=d;
}
sum1=0;
for(c=a;c<=b;c++)
{i=c;sum1=0;
while(true)
{sum1++;
if(i==1)
break;
if(i%2==0)
i=i/2;
else
i=i*3+1;
}
if(sum1>sum)
sum=sum1;
}
cout<<e<<" "<<f<<" "<<sum<<endl;}
return 0;
}
Reply
|