题解 | 循环汉诺塔
循环汉诺塔
https://www.nowcoder.com/practice/cdf0808f841748faba058c8ef538c731
n = int(input())
if n <= 1:
print(1,2)
else:
x = 1
y = 2
for i in range(2, n+1):
temp = y*2
y = (x+temp+2)%1000000007
x = (temp+1)%1000000007
print(x, y)
循环汉诺塔
https://www.nowcoder.com/practice/cdf0808f841748faba058c8ef538c731
n = int(input())
if n <= 1:
print(1,2)
else:
x = 1
y = 2
for i in range(2, n+1):
temp = y*2
y = (x+temp+2)%1000000007
x = (temp+1)%1000000007
print(x, y)
相关推荐
牛客85586392...:就团子这base 拉完了还top