-
[Python] Programmers 위클리 12주차 피로도알고리즘/문제풀이 2021. 11. 3. 13:58728x90
[Python] Programmers 위클리 12주차 피로도
1. 문제 링크
https://programmers.co.kr/learn/courses/30/lessons/87946
2. 문제 요약
- 최대 던전을 방문할 수 있는 수를 출력
3. 아이디어 정리
- 순열을 이용하여 모든 경우를 확인한다.
4. 문제 풀이
4-1. 내 풀이
from itertools import permutations def solution(k, dungeons): answer = 0 for com in permutations(dungeons, len(dungeons)): count = 0 temp_k = k for c in com: need, del_ = c if temp_k < need: answer = max(answer, count) break else: temp_k -= del_ count += 1 answer = max(answer, count) return answer
5. 결론
- 순열 문제
'알고리즘 > 문제풀이' 카테고리의 다른 글
[Python] 백준 13975 파일 합치기 3 (0) 2021.11.26 [Python] 백준 4358 생태학 (0) 2021.11.26 [Python] 백준 1476 날짜계산 (0) 2021.11.03 [Python] 백준 17086 아기 상어 2 (0) 2021.10.30 [Python] 백준 2470 두 용액 (0) 2021.10.30