본문 바로가기
python-algorithm

[백준] 4635

by 무적김두칠 2021. 3. 12.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import sys
while 1:
    n=int(sys.stdin.readline())
    if n==-1: break
    permile=[]
    tmptime=[0]
    time=[]
    ans=0
    for i in range(n):
        a,b=map(int, sys.stdin.readline().split())
        permile.append(a)
        tmptime.append(b)
    for i in range(n):
        time.append(tmptime[i+1]-tmptime[i])
    for i in range(n):
        ans+=permile[i]*time[i]
    print("%d miles"%ans)
cs
반응형

'python-algorithm' 카테고리의 다른 글

[백준] 4758  (0) 2021.03.16
[백준] 4714  (0) 2021.03.16
[백준] 20976  (0) 2021.03.12
[백준] 20673  (0) 2021.03.12
[백준] 20499  (0) 2021.03.12

댓글