Skip to content

Commit 4760e07

Browse files
committed
1 parent f430408 commit 4760e07

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Hongjoo/lv2/피로도.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from itertools import permutations
2+
3+
def solution(k, dungeons):
4+
# k : current_tired
5+
#1.순열 -> 입장 순서 모든 경우의 수
6+
dun_len= len(dungeons)
7+
order = permutations(dungeons , dun_len)
8+
answer = 0
9+
#2.입장 가능 여부 확인 => 최대 던전 수 = answer 반환
10+
# k < 최소 필요 피로도 , break
11+
# 최소 필요 피로도 >= 소모 피로도
12+
for permute in order :
13+
hp = k
14+
count = 0
15+
for p in permute :
16+
17+
if hp >= p[0] :
18+
hp -=p[1]
19+
count += 1
20+
if count >answer :
21+
answer = count
22+
23+
return answer

0 commit comments

Comments
 (0)