题解 | #魔法数字变换#
魔法数字变换
https://www.nowcoder.com/practice/db41a6ce80a646aa9a5eb6252ac2df76
n = int(input()) step = 0 while n != 1: if n % 2 == 0: n /= 2 step += 1 else: n = n*3 + 1 step += 1 print(step)#题解#
魔法数字变换
https://www.nowcoder.com/practice/db41a6ce80a646aa9a5eb6252ac2df76
n = int(input()) step = 0 while n != 1: if n % 2 == 0: n /= 2 step += 1 else: n = n*3 + 1 step += 1 print(step)#题解#
相关推荐