BOJ - 14541 - Speed Limit
Updated:
import sys
def solution():
while True:
N = int(sys.stdin.readline())
if N == -1: return
tLast = 0
ret = 0
for _ in range(N):
s, t = map(int, sys.stdin.readline().split())
ret += (t - tLast) * s
tLast = t
print("%d miles"%ret)
solution()
https://www.acmicpc.net/problem/14541
Leave a comment