[HihoCoder] Highway 高速公路问题

简介:

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

3
3 5 1
1 4 2
0 8 3

Sample Output

2.00
1.50
3.00

本文转自博客园Grandyang的博客,原文链接:高速公路问题[HihoCoder] Highway ,如需转载请自行联系原博主。

相关文章
|
11月前
|
存储 消息中间件 OLAP
Hologres+Flink企业级实时数仓核心能力介绍-2024实时数仓Hologres线上公开课03
本次分享由阿里云产品经理骆撷冬(观秋)主讲,主题为“Hologres+Flink企业级实时数仓核心能力”,是2024实时数仓Hologres线上公开课的第三期。课程详细介绍了Hologres与Flink结合搭建的企业级实时数仓的核心能力,包括解决实时数仓分层问题、基于Flink Catalog的Streaming Warehouse实践,并通过典型客户案例展示了其应用效果。
337 10
Hologres+Flink企业级实时数仓核心能力介绍-2024实时数仓Hologres线上公开课03
|
12月前
|
人工智能
《AI助力生物学:基因编辑与蛋白质结构解析的加速引擎》
在生物学研究中,AI正发挥重要作用,特别是在基因编辑和蛋白质结构解析方面。AI通过设计新型基因编辑工具(如OpenCRISPR™)、提高编辑效率与精准度(如EVOLVEpro),以及优化整个编辑过程,显著加速了基因编辑的研究进展。在蛋白质结构解析领域,AI技术如AlphaFold实现了精准预测蛋白质三维结构,加速了蛋白质设计与改造,并解析蛋白质相互作用网络。这不仅推动了医学和农业领域的发展,也带来了伦理和法律等挑战,需要确保其健康、可持续发展。
422 11
|
NoSQL 关系型数据库 MySQL
Vgo-适合golang初学者的开源框架
# Vgo Vgo是一款基于Gin的开源服务端框架,集成了Redis、Mysql、JWT及队列等技术栈,适合Golang初学者。项目包括Vgo-Gitee和VgoAdmin-Gitee,可通过克隆仓库并按照安装指南进行部署。其目录结构清晰,涵盖路由、模型、后台接口等功能模块,更多功能持续开发中。
354 3
|
传感器 人工智能
上交、智源、北大等提出空间大模型SpatialBot
【8月更文挑战第29天】近年来,人工智能技术迅猛发展,视觉语言模型(VLMs)在2D图像理解上取得显著成就,但在空间理解方面仍面临挑战。上交、智源、北大等机构的研究人员提出了结合RGB和深度图像的空间大模型SpatialBot,以提升空间理解精度。通过使用包含多层次深度信息的SpatialQA数据集进行训练,并基于全面评估基准SpatialBench测试,SpatialBot在多个任务中表现出色,显著提升了空间理解能力。然而,其应用仍受限于部署成本和数据集泛化能力等问题。论文链接: https://arxiv.org/abs/2406.13642
314 3
|
Android开发
解决android apk安装后出现2个相同的应用图标
解决android apk安装后出现2个相同的应用图标
868 2
|
安全 网络安全 文件存储
DIY nas 之tailscale组件虚拟局域网
tailscale解决没有公网IP而又需要进行远程办公的问题
919 0
|
存储 关系型数据库 测试技术
|
NoSQL Java 关系型数据库
开源系统推荐短信网关
开源系统推荐短信网关
405 0
|
人工智能 数据处理 云计算
刊首语|计算到底是算什么
刊首语/EDITORS' NOTE
354 0
|
存储 弹性计算 编解码
阿里云轻量应用服务器与u1、c7、g7、r7、c8y、g8y、r8y实例区别及选择参考
目前在阿里云各个活动中可选的云服务器类型有轻量应用服务器和通用算力型u1、计算型c7、通用型g7、内存型r7、计算型c8y、通用型g8y、内存型r8y,对出初次选购阿里云服务器的用户来说,有的用户不知道他们之间有什么区别,也就不知道怎么选择了,下面小编来介绍一下他们之间的区别,以供大家参考和选择。
2426 0
阿里云轻量应用服务器与u1、c7、g7、r7、c8y、g8y、r8y实例区别及选择参考