백준 15686

Baekjoon/구현

🥇[백준] 15686 치킨 배달 (골드5) / 구현, 백트래킹

문제요약 나의 코드 및 설명 백트래킹을 활용하여 가능한 m개의 치킨집 좌표 케이스들을 저장하고, 하나씩 탐색하며 최단 치킨거리를 찾는다. #백트래킹으로 폐업시키지 않을 치킨집 구하기 def dfs(count, start, temp_list): if len(temp_list) == m: #m개가 되면, result.append(temp_list) #result에 저장된 리스트 저장 후 리턴 return for i in range(start, len(chicken)): if i not in v: v.append(i) dfs(count+1, i+1, temp_list+[chicken[i]]) v.pop() n, m = map(int, input().split()) board = [list(map(int, in..

hellosonic
'백준 15686' 태그의 글 목록