Code: Select all
import java.util.Scanner;
class Main
{
public static void main(String [] args)
{
Scanner e=new Scanner(System.in);
while (e.hasNext())
{
int p=0;
int r=0;
int i= e.nextInt();
int j = e.nextInt();
if (j<i)
{
p=i;
r=j;
int temp=i;
i=j;
j=temp;
}
else
{
p=i;
r=j;
}
int [] a=new int [j+1];
int m=i;
while (m<=j)
{
int n=m;
int c=1;
while (n!=1)
{
if (n%2!=0)
{
n=3*n+1;
}
else
{
n=n/2;
}
c++;
}
a[m]=c;
m++;
}
int max=a[0];
int c=1;
while (c<j)
{
if (max<a[c])
{
max=a[c];
}
c++;
}
System.out.println(p+" "+r+" "+max);
}
}
}