/*
Time:2019.11.6
Author: Goven
type:暴力(数据大可以用线段树做--目前不会)
err:
ref:错误原因:https://blog.csdn.net/qq_34940489/article/details/82759552
*/
#include<iostream>
#define MAXN 10005
using namespace std;
int a[MAXN];
int main()
{
int n;
for (int i = 1; i < 10000; i++) {//也可以直接暴力做
a[i] = 1;
n = i;
while (n != 1) {
if (n % 2) n = 3 * n + 1;
else n = n / 2;
a[i]++;
}
}
int i, j, ti, tj;
while(cin >> i) {
cin >> j;
ti = min(i, j);//err1:输入可能 i > j
tj = max(i, j);
n = 0;
for (int k = ti; k <= tj; k++) {
if (n < a[k]) n = a[k];
}
cout << i << " " << j << " " << n << endl;//err2:输出要跟输入的ij顺序一样
}
return 0;
}
网友评论