Skip to content

Commit 7b655f6

Browse files
committed
98차 1번 문제 풀이 (푸는중)
1 parent 204e816 commit 7b655f6

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

live9/test98/문제1/박희경.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import sys
2+
3+
input = sys.stdin.readline
4+
5+
n, m = map(int, input().split())
6+
a = list(map(int, input().split()))
7+
8+
i = 1
9+
dp = [0] * (n + 1)
10+
dp[0] = 1
11+
12+
while m > 0 or i <= n:
13+
# print(i, m, dp)
14+
if dp[i-1] + a[i+1] > dp[i-1]//2 + a[i+2]:
15+
dp[i] = dp[i-1] + a[i+1]
16+
print("굴리기", dp)
17+
i += 1
18+
else:
19+
dp[i] = dp[i-1]//2 + a[i+2]
20+
print("던지기", dp)
21+
i += 2
22+
m -= 1
23+
24+
print(dp)
25+
26+
"""
27+
10 5
28+
1 3 4 5 6 7 8 10 12 14
29+
"""

0 commit comments

Comments
 (0)