Problem 1923 --Problem A: Average Speed

1923: Problem A: Average Speed

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $16$ 正确数量 $12$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签

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为单位的新速度。每个查询都由包含运行时间的行表示。在旅行开始时,汽车是静止的。运行时间以非递减的顺序给出,在任何给定的时间内最多只有一个速度变化。


对于标准输入中的每个查询,您应该按照下面的格式打印一条表示时间和旅行距离的行。

00:00:01 100
00:15:01
00:30:01
01:00:01 50
03:00:01
03:00:05 140
00:15:01 25.00 km
00:30:01 50.00 km
03:00:01 200.00 km

推荐代码 查看1923 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$0 $ms] 淡意的温柔 589689 2020-06-01 09:52:49
内存最少[$944 $KB] 刘璋@计算机科学与技术172 256069 2018-05-31 09:26:06
第一AC AOJ大管家 84438 2017-04-27 15:29:47
第一挑战 AOJ大管家 84438 2017-04-27 15:29:47

赛题来源/所属竞赛 NA N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛
1149 2017-2018-2《C语言程序设计II》课下练习@2017计算机科学与技术123 2018-03-06 12:00:00 请登录