We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 27e2d88 commit 0cd4509Copy full SHA for 0cd4509
1 file changed
live9/test98/문제1/백유진.py
@@ -1,2 +1,25 @@
1
+from itertools import product
2
n, m = map(int, input().split())
-arr = list(map(int, input().split()))
3
+arr = list(map(int, input().split()))
4
+
5
+dx = [1, 2]
6
7
+max = float("-inf")
8
9
+for p in product(dx, repeat=m):
10
+ now = 0
11
+ snow = 1
12
+ for i in p:
13
+ if i == 1:
14
+ now += 1
15
+ if now < len(arr):
16
+ snow += arr[now]
17
+ if i == 2:
18
+ now += 2
19
20
+ snow //= 2
21
22
+ if snow > max:
23
+ max = snow
24
25
+print(max)
0 commit comments