Skip to content

Commit 807f57e

Browse files
committed
[BOJ] 스티커 / 실버 1 / 40분
https://www.acmicpc.net/problem/9465
1 parent efc2b1d commit 807f57e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
t = int(input())
2+
3+
for i in range(t):
4+
col = int(input())
5+
graph=[]
6+
for j in range(2):
7+
graph.append(list(map(int, input().split())))
8+
9+
if col == 1:
10+
print(max(graph[0][0], graph[1][0]))
11+
continue
12+
13+
graph[0][1] += graph[1][0]
14+
graph[1][1] += graph[0][0]
15+
16+
for k in range(2, col):
17+
graph[0][k] += max(graph[1][k-1], graph[1][k-2])
18+
graph[1][k] += max(graph[0][k-1], graph[0][k-2])
19+
20+
print(max(graph[0][col-1], graph[1][col-1]))

0 commit comments

Comments
 (0)