解题思路:
注意事项: i,j的大小不确定的,要分类来做,我第一次就错了
参考代码:
while True: t = False m = [] a, b = map(int,input().split()) if a>b: a, b = b, a t = True for i in range(a,b+1): x = i c = [x] count = 1 while True: if 1 in c: break elif x&1: x = x*3+1 else: x = x//2 c.append(x) count += 1 m.append(count) if t: print(b,a,max(m)) else: print(a,b,max(m))
0.0分
3 人评分