logo AlgoBeat OnlineJudge
登录 注册

#216242. [ICPC 2014 NAIPC] Reconnaissance

内存限制:512 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

You have located a major supply line that the enemy has been using. With satellite imaging, you've been able to determine the current location and velocity of every vehicle along the supply line, which is for all practical purposes an infinitely long straight line. Furthermore, you know that each vehicle moves at constant velocity, and that they can pass by each other without incident along this supply line. What you need to do now is deploy an air drone with special sensors that can give you readings of the contents of the vehicles. The sensor is capable of reading everything in its range instantaneously, but power limitations allow it to do so only once. In order to minimize the required range, you want to deploy it when the vehicles are as close to each other as possible. Given knowledge of the current location and velocity of all the vehicles, what is the closest that the vehicles will get to each other?

输入格式

There will be several test cases in the input. Each test case will begin with a line with a single integer () representing the number of vehicles. Each of the next lines will have two integers, and (), indicating the position (, in meters) and velocity (, in meters/hour) of that vehicle. The sign of velocity indicates direction. The input will end with a line with a single 0.

输出格式

For each test case, output a single number equal to the minimum distance that will cover all of the vehicles at some time, in meters, given to exactly two decimal places, rounded. Output each number on its own line, with no spaces. Do not print any blank lines between outputs.

样例

样例输入 1

2
-100 1
100 -1
3
-100 1
100 -1
101 -1
3
-100 -1
0 0
100 1
0

样例输出 1

0.00
1.00
200.00