Problem A: Average Speed
You have bought a car in order to drive from Waterloo to a big city. The odometer on their car is broken, so you cannot measure distance. But the speedometer and cruise control both work, so the car can maintain a constant speed which can be adjusted from time to time in response to speed limits, traffic jams, and border queues. You have a stopwatch and note the elapsed time every time the speed changes. From time to time you wonder, "how far have I come?". To solve this problem you must write a program to run on your laptop computer in the passenger seat.
Standard input contains several lines of input: Each speed change is indicated by a line specifying the elapsed time since the beginning of the trip (hh:mm:ss), followed by the new speed in km/h. Each query is indicated by a line containing the elapsed time. At the outset of the trip the car is stationary. Elapsed times are given in non-decreasing order and there is at most one speed change at any given time.
For each query in standard input, you should print a line giving the time and the distance travelled, in the format below.
你买了一辆车,是为了从滑铁卢开车到大城市去。他们汽车上的里程表坏了,所以你无法测量距离。但速度计和巡航控制都可以工作,所以汽车可以保持一个恒定的速度,可以随时调整,以响应速度限制,交通堵塞和边境排队。你有一个秒表,记录每次速度变化所经过的时间。有时你会想,“我已经走了多远了?”要解决这个问题,你必须编写一个程序,在乘客座的笔记本电脑上运行。
标准输入包含几行输入:每一个速度变化都用一条线表示,它指定了自开始运行以来的时间(hh:mm:ss),然后是以km/h为单位的新速度。每个查询都由包含运行时间的行表示。在旅行开始时,汽车是静止的。运行时间以非递减的顺序给出,在任何给定的时间内最多只有一个速度变化。
对于标准输入中的每个查询,您应该按照下面的格式打印一条表示时间和旅行距离的行。