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