We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f430408 commit 4760e07Copy full SHA for 4760e07
Hongjoo/lv2/피로도.py
@@ -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