Skip to content

Commit eabaa78

Browse files
authored
[Baekjoon] 그리디 - 13305번 코드
1 parent d2b0445 commit eabaa78

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

그리디/13305.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import sys
2+
input = sys.stdin.readline
3+
N = int(input())
4+
distance = list(map(int, input().split()))
5+
price = list(map(int, input().split()))
6+
7+
result = price[0] * distance[0]
8+
low = price[0]
9+
10+
for i in range(1, N-1):
11+
if(price[i] < low):
12+
low = price[i]
13+
result += low * distance[i]
14+
15+
print(result)

0 commit comments

Comments
 (0)