#include<stdio.h> void funtion(int n1,int n2); int main() { int n1,n2; while(scanf("%d %d",&n1,&n2)==2) { funtion(n1,n2); } return 0; } void funtion(int n1,int n2) { int i,m1,m2,j,k,l,m=0,n=1,c=0; m1=n1; m2=n2; if(m1>m2) { i=m1; m1=m2; m2=i; } for(i=m1;i<=m2;i++) { k=i;n=1; while(k!=1) { if(k%2==0) { k=k/2; } else { k=k*3+1; } n++; } if(n>m) { m=n; } } printf("%d %d %d\n",n1,n2,m); }
No comments:
Post a Comment