출처 : https://www.acmicpc.net/problem/2979
In [1]:
A, B, C = map(int, input().split())
In [2]:
array = [list(map(int, input().split())) for _ in range(3)]
In [3]:
# array
Out[3]:
In [4]:
n = max(array[0][1], array[1][1], array[2][1])
In [5]:
board = [0]*(n-1)
In [6]:
for car in array:
for i in range(car[0]-1, car[1]-1):
board[i] = board[i]+1
In [7]:
# board
Out[7]:
In [8]:
sumv = 0
for num in board:
if num == 1: sumv = sumv + A
elif num == 2: sumv = sumv + 2*B
elif num == 3: sumv = sumv + 3*C
In [9]:
print(sumv)
'알고리즘 > [Python] 백준' 카테고리의 다른 글
(Python) 백준 14501번: 퇴사 (0) | 2020.02.23 |
---|---|
(Python) 백준 11559번: Puyo Puyo (0) | 2020.02.22 |
(Python) 백준 2161번: 카드 1 (0) | 2020.02.20 |
(Python) 백준 5532번: 방학 숙제 (0) | 2020.02.20 |
(Python) 백준 15685번 : 드래곤 커브 (0) | 2020.02.20 |