← Back to List

4635번: Speed Limit ↗

Solutions

Python 3
184 B | 184 chars
while True:
    a=int(input())
    if a == -1:
        break
    s,k=0,0
    for i in range(a):
        b,c=map(int,input().split())
        s+=b*(c-k)
        k=c
    print(s,"miles")