We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eccce80 commit 9706c51Copy full SHA for 9706c51
1 file changed
live9/test95/문제1/백한결.py
@@ -0,0 +1,30 @@
1
+import itertools
2
+
3
4
+def solution(k, dungeons):
5
+ answer = -1
6
7
+ counts = []
8
9
+ p = itertools.permutations(dungeons, len(dungeons))
10
11
+ for i in p:
12
+ counts.append(maxDungeons(k, i))
13
14
+ counts.sort()
15
16
+ return counts[-1]
17
18
19
+def maxDungeons(k, dungeons):
20
+ count = 0
21
+ health = k
22
23
+ for dungeon in dungeons:
24
+ if dungeon[0] > health:
25
+ break
26
+ else:
27
+ count += 1
28
+ health -= dungeon[1]
29
30
+ return count
0 commit comments