코딩테스트

백준 13305

eunGI 2022. 1. 18. 23:57
n = int(input())

distance = list(map(int, input().split()))
price = list(map(int, input().split()))

total = 0
small = price[0]

for i in range(0, n-1): # 마지막 가격은 필요없는 값이니까 n-1까지만 돌아도 상관없음
    if price[i] < small:
        small = price[i]

    total = total + distance[i] * small

print(total)

 

'코딩테스트' 카테고리의 다른 글

DFS/BFS  (0) 2022.02.15
백준 4796  (0) 2022.01.19
백준 1789  (0) 2022.01.18
백준 10610  (0) 2022.01.18
백준 10162  (0) 2022.01.17