博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[HihoCoder] Highway 高速公路问题
阅读量:6279 次
发布时间:2019-06-22

本文共 1541 字,大约阅读时间需要 5 分钟。

Description

In the city, there is a one-way straight highway starts from the northern end, traverses the whole city southward, and finishes at the southern end. Due to some financial difficulties, there is only one lane on this highway, which means that overtaking other cars in front is impossible.

The highway is quite busy. Lots of different cars are running on it every day. For each car, it is running on the highway at the point which X km far from the northern end in Minute 0, and will leave at the point which Y km far from the northern end. Each car also has a speed limit L km/min. During the whole trip on the highway, each car should run as fast as possible without exceeding its speed limit or overtaking other cars in front. In addition, no two or more cars will be at the same point at Minute 0. Cars can be regarded as points and the distance between two cars can be infinitely small.

Given the information of N cars, please calculate the leaving time for each car.

Input

The first line contains one integer N. 2 <= N <= 1000.

Then follows N line. Each line contains three integers X, Y and L, showing the information of this car. 0 <= X < Y <= 1000000, 0 < L <= 10.

Output

Output N real numbers, one per line -- the leaving time (in minute) of each car, preserving the input order of cars. Your answers should be rounded to 2 digits after the decimal point and the output must contain exactly 2 digits after the decimal point.

Sample Input

33 5 11 4 20 8 3

Sample Output

2.001.503.00

本文转自博客园Grandyang的博客,原文链接:,如需转载请自行联系原博主。

你可能感兴趣的文章
我的友情链接
查看>>
vim使用点滴
查看>>
embedded linux学习中几个需要明确的概念
查看>>
mysql常用语法
查看>>
Morris ajax
查看>>
【Docker学习笔记(四)】通过Nginx镜像快速搭建静态网站
查看>>
ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
查看>>
<转>云主机配置OpenStack使用spice的方法
查看>>
java jvm GC 各个区内存参数设置
查看>>
[使用帮助] PHPCMS V9内容模块PC标签调用说明
查看>>
关于FreeBSD的CVSROOT的配置
查看>>
基于RBAC权限管理
查看>>
基于Internet的软件工程策略
查看>>
数学公式的英语读法
查看>>
留德十年
查看>>
迷人的卡耐基说话术
查看>>
PHP导出table为xls出现乱码解决方法
查看>>
PHP问题 —— 丢失SESSION
查看>>
Java中Object类的equals()和hashCode()方法深入解析
查看>>
数据库
查看>>