λ¬Έμ λ§ν¬ : https://www.acmicpc.net/problem/11729
11729λ²: νλ Έμ΄ ν μ΄λ μμ
μΈ κ°μ μ₯λκ° μκ³ μ²« λ²μ§Έ μ₯λμλ λ°κ²½μ΄ μλ‘ λ€λ₯Έ nκ°μ μνμ΄ μμ¬ μλ€. κ° μνμ λ°κ²½μ΄ ν° μμλλ‘ μμ¬μλ€. μ΄μ μλμΉλ€μ΄ λ€μ κ·μΉμ λ°λΌ 첫 λ²μ§Έ μ₯λμμ μΈ λ²μ§Έ μ₯λλ‘
www.acmicpc.net
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])) ν΅ν΄μ νλμ 리μ€νΈμ μ μ₯ν μ μλ€.
Append a tuple to a list - what's the difference between two ways?
I wrote my first "Hello World" 4 months ago. Since then, I have been following a Coursera Python course provided by Rice University. I recently worked on a mini-project involving tuples and lists. ...
stackoverflow.com
μ°Έκ³ μ ν¬λΈ >> 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 |