λ¬Έμ λ§ν¬ : https://www.acmicpc.net/problem/11729
n = int(input())
count = 0
startList = []
destList = []
def hanoi(n, start, dest, sub):
global count
if n == 1:
count += 1
startList.append(start)
destList.append(dest)
return
hanoi(n - 1, start, sub, dest)
count += 1
startList.append(start)
destList.append(dest)
hanoi(n - 1, sub, dest, start)
hanoi(n, 1, 3, 2)
print(count)
for i in range(count):
print(startList[i], destList[i])
νΉμ results.append(tuple([start, dest])) ν΅ν΄μ νλμ 리μ€νΈμ μ μ₯ν μ μλ€.
μ°Έκ³ μ ν¬λΈ >> https://www.youtube.com/watch?v=FYCGV6F1NuY
λ°μν
'κ°λ° > π€ μκ³ λ¦¬μ¦' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
baekjoon. 2559 μμ΄ [Silver III][python] (0) | 2023.08.20 |
---|---|
baekjoon. 14890 κ²½μ¬λ‘ [Gold III][python] (0) | 2023.08.13 |
baekjoon. 15486 ν΄μ¬ 2 [Gold V][python] (0) | 2023.07.06 |
β‘οΈ baekjoon. 1489 λκ²° [Gold I][python] (0) | 2023.06.29 |
β‘οΈ baekjoon. 14501 ν΄μ¬ [Silver III][python] (0) | 2023.06.28 |