Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***********************************************************************\
- |*********S*** ****** ************* ************ ************** ******|
- |*********** ******** ************ ************ *********** ** ******|
- |********* ********** *********** *** ********** * ********* *** ******|
- |******** *********** *I******** **** ********** *** ***** ***** ******|
- |******** *********** ********* ****** ********* ***** ** ****** ******|
- |********** ********* ******** ***A**** ******** ******* ******* ******|
- |*********** ******** ******* ********** ******* *************** ******|
- |********** ********* ****** ************ ****** *************** ******|
- |******** *********** ***** ************** ***** ********M****** ******|
- |***** ************** **** **************** **** *************** ******|
- |***********************************************************************|
- |**************BSMRSTU********************************CSE***************|
- \***********************************************************************/
- #include<stdio.h>
- #include<string.h>
- #include<math.h>
- #include<conio.h>
- #include<stdlib.h>
- #define ll long long
- #define B break
- #define C continue
- #define sf scanf
- #define pf printf
- #define byebye return 0
- int main()
- {
- int a,b;
- while(sf("%d%d",&a,&b)!=EOF)
- {
- pf("%d %d",a,b);
- if(a>b){
- int n=a;
- a=b;
- b=n;
- }
- int i,j,total=0;
- for(i=a; i<=b; i++)
- {
- int count=1;
- j=i;
- while(j!=1)
- {
- if(j%2)
- {
- j=(3*j)+1;
- }
- else
- {
- j=j/2;
- }
- count++;
- }
- if(total<count)
- total=count;
- }
- pf(" %d\n",total);
- }
- byebye;
- }
Advertisement
Add Comment
Please, Sign In to add comment