Skip to content

Commit 3902c53

Browse files
authored
#14 : 11729_하노이 탑
#14 : Week3_예원이티
1 parent 69ad8d4 commit 3902c53

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
n = int(input())
2+
3+
def top(n, a, b, c):
4+
5+
if n == 1:
6+
print(a, c)
7+
8+
else:
9+
top(n-1, a, c, b)
10+
print(a, c)
11+
top(n-1, b, a, c)
12+
13+
sum = 2 ** n -1
14+
print(sum)
15+
16+
top(n, 1, 2, 3)

0 commit comments

Comments
 (0)