Skip to content

Commit 0cd4509

Browse files
committed
98차 1번 문제풀이(푸는중)
1 parent 27e2d88 commit 0cd4509

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

live9/test98/문제1/백유진.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1+
from itertools import product
12
n, m = map(int, input().split())
2-
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+
if now < len(arr):
20+
snow //= 2
21+
snow += arr[now]
22+
if snow > max:
23+
max = snow
24+
25+
print(max)

0 commit comments

Comments
 (0)