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