from itertools import permutations def solution(k, dungeons): answer = -1 per_dg = permutations(dungeons, len(dungeons)) for i in per_dg: piro = k cnt = 0 for j in i: if piro >= j[0] and piro-j[1] >= 0: piro -= j[1] cnt += 1 else: break if answer < cnt: answer = cnt return answer 각 던전들의 모든 경우의 수를 생각한 순열 배열을 만든 후, 모든 경우 중 최대 던전을 돈 횟수를 출력한다. (처음에 permutations(dungeons, len(dungeons) 에서 len(dungeon..