본문 바로가기

알고리즘/백준 알고리즘 풀이

[Silver 4] 13305번 주유소

백준 13305번 주유소 문제 풀이 코드입니다~

import sys

input = sys.stdin.readline

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

price.pop(-1)

result = 0
temp_price = price[0]

for i in range(len(price)):
    temp_price = min(temp_price, price[i])
    result += temp_price * distance[0]
    distance.pop(0)

print(result)

궁금한건 댓글 남겨주세요~

'알고리즘 > 백준 알고리즘 풀이' 카테고리의 다른 글

[Bronze 2] 2920번 음계  (3) 2021.09.15
[Bronze 1] 1157번 단어 공부  (2) 2021.09.15
[Silver 5] 4673번 셀프 넘버  (0) 2021.09.15
[Silver 5] 1010번 다리 놓기  (0) 2021.09.15
[Silver 4] 1002번 터렛  (0) 2021.09.15