从第 n 步向前走,当 n 为奇数时,上一步是“22娘”走的,2x + 1 = n,x = (n - 1) / 2;当 n 为偶数时,上一步是“33娘”走的,2x + 2 = n,x = (n - 2) / 2。
# 2x + 1 = n, x = (n - 1) / 2,上一步为奇数
# 2x + 2 = n, x = (n - 2) / 2,上一步为偶数
n = int(input())
res = ''
while n:
if n % 2 == 1:
res = '2' + res
n = (n - 1) // 2
else:
res = '3' + res
n = (n - 2) // 2
print(res) 
京公网安备 11010502036488号