Notice
Recent Posts
Recent Comments
Link
나의 개발일지
[백준] 13305번 주유소 [Python] 본문
- 문제 : https://www.acmicpc.net/problem/13305
- Greedy Algorithm
n = int(input())
road = list(map(int, input().split()))
price = list(map(int, input().split()))
won = price[0]
sum = 0
for i in range(n-1):
if won > price[i]: # 더 싼 주유소가 나오면
won = price[i] # 가격을 바꿔주자
sum += (won * road[i])
print(sum)
'백준' 카테고리의 다른 글
[백준] 9205번 맥주 마시면서 걸어가기 [Python, 파이썬] (0) | 2023.09.05 |
---|---|
[백준] 1111번 IQ Test [Python, 파이썬] (0) | 2023.09.04 |
[백준] 2294번 동전 2 [Python] (0) | 2023.08.04 |
[백준] 1939번 중량제한 [Python] (0) | 2023.08.04 |
[백준] 2638번 치즈 [Python] (0) | 2023.08.02 |
Comments