-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path100.c
40 lines (39 loc) · 843 Bytes
/
100.c
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
36
37
38
39
40
#include <stdio.h>
main()
{
int i,j,n,b,max,count,temp,lmt;
while(scanf("%d%d",&b,&n)!=EOF)
{
lmt=-1;
printf("%d %d ",b,n);
max=0;
if(b>n)
{
temp=b;
b=n;
n=temp;
}
for(i=b;i<=n;i++)
{
count=1;
for(j=i;j>1; )
{
if(j%2!=0)
{
j=(3*j)+1;
}
else if(j%2==0)
{
j=(j/2);
}
count++;
}
if(max<count)
{
max=count;
}
}
printf("%d\n",max);
}
return 0;
}