#include <stdio.h>
#include <stdlib.h>
int f(int x)
{
int i=0;
while(1){
if(x==1)break;
if(x%2==0)x=x/2;
else x=3*x+1;
i++;
}
return i+1;
}
int main()
{
int a,b,t,i,c;
while(~scanf("%d%d",&a,&b)){
printf("%d %d ",a,b);
if(a>b){
t=a;
a=b;
b=t;
}
int max=0;
for(i=a;i<=b;i++){
c=f(i);
max=c>max?c:max;
}
printf("%d\n",max);
}
return 0;
}
读英语真的好心累
将一个数按照题目描述的方法处理,到这个数变为一为止,记录他经历的循环次数
在输入的i和j之间找循环次数最多的数字,输出最大循环次数
暴力就能过