题解 | #扭蛋机#python递归
扭蛋机
https://www.nowcoder.com/practice/9d26441a396242a9a0f7d2106fc130c7
N=int(input()) def func(n): if n==1: return '2' if n==2: return '3' if (n-2)%2==0: return func((n-2)/2)+'3' else: return func((n-1)/2)+'2' print(func(N))
扭蛋机
https://www.nowcoder.com/practice/9d26441a396242a9a0f7d2106fc130c7
N=int(input()) def func(n): if n==1: return '2' if n==2: return '3' if (n-2)%2==0: return func((n-2)/2)+'3' else: return func((n-1)/2)+'2' print(func(N))
相关推荐