Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- long long a,b,i,n,m,count,max;
- while(scanf("%lld%lld",&a,&b)==2)
- {
- max=0;
- printf("%lld %lld ",a,b);
- if(a>b)
- {
- m=b;
- b=a;
- a=m;
- }
- for(i=a;i<=b;i++)
- {
- count=1;
- n=i;
- while(n>1)
- {
- if(n&1)
- n=3*n+1;
- else
- n/=2;
- count++;
- }
- if(count>max)
- max=count;
- }
- printf("%lld\n",max);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement