파이썬

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)
lim.dev
'파이썬' 태그의 글 목록