We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1840715 commit 8125056Copy full SHA for 8125056
1 file changed
[211125] 피로도/YooRiChae.py
@@ -1,19 +1,27 @@
1
from itertools import permutations
2
3
def solution(k, dungeons):
4
+
5
+ # 조합에 있는 던전 순서대로 다 탐험할 수 있는지
6
def check(now, d_list):
7
for m,c in d_list:
8
+ # 못깨면 바로 return
9
if now < m:
10
return False
11
now -=c
12
return True
13
14
answer = -1
15
16
+ # 몇개의 던전을 탐험할지..
17
for n in range(1, len(dungeons)+1):
18
+ # 탐험 순서 가져오기
19
dungeons_list = list(permutations(dungeons, n))
20
for dungeon in dungeons_list:
21
22
if check(k, dungeon):
23
answer = n
24
+ # 탐험할 수 있으면 다음 갯수로
25
break
26
27
return answer
0 commit comments