File size: 388 Bytes
c4b0eef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<stdio.h>
int main()

{
int n,m,i,k,j,c,s;
while(scanf("%d %d",&n,&m)==2)
{
s=0;
printf("%d %d ",n,m);
if(n>m)
{
k=m;
m=n;
n=k;
}
for(i=n;i<=m;i++)
    {
    c=1;
    j=i;
    while(j>1)
        {
        if(j%2==0)
        j=j/2;
        else
        j=(3*j)+1;
        c++;
        }
    if(c>=s)
    s=c;
    }
printf("%d\n",s);
}
return 0;
}