파이썬
[Python] Hanoi.py 하노이의 탑
2020.02.07
· Coding Test/Python
def hanoi(n, from_pos, to_pos, aux_pos): if n == 1: print(from_pos,'->',to_pos) return hanoi(n-1, from_pos, aux_pos, to_pos) print(from_pos, '->', to_pos) #출력; 원반을 옮기는 순서 hanoi(n-1, aux_pos, to_pos, from_pos) hanoi(3,1,3,2)
이전
1
다음
'파이썬' 태그의 글 목록
구독하기
테마
상단으로
티스토리툴바
코딩림
구독하기