🌏 문제
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
👽 풀이
from itertools import permutations
def solution(k, dungeons):
answer = -1
orders = list(permutations(dungeons, len(dungeons)))
for order in orders:
cnt = 0
current = k
for a,b in order:
if current >= a:
current -= b
cnt += 1
else:
break
answer = max(answer, cnt)
return answer
728x90
'💡코딩테스트 > 프로그래머스' 카테고리의 다른 글
[프로그래머스 | 파이썬 python] 모음사전 (0) | 2023.04.21 |
---|---|
[프로그래머스 | 파이썬 python] 전력망을 둘로 나누기 (0) | 2023.04.21 |
[프로그래머스 | 파이썬 python] 카펫 (0) | 2023.04.21 |
[프로그래머스 | 파이썬 python] 소수 찾기 (0) | 2023.04.21 |
[프로그래머스 | 파이썬 python] 모의고사 (0) | 2023.04.21 |