题目描述
A particularly inefficient telephone company seeks to claim they provide high-speed broadband access to customers. It will suffice for marketing purposes if they can create just one such link directly connecting two locations. As the cost for installing such a connection is proportional to the distance between the sites, they need to know which pair of locations are the shortest distance apart so as to provide the cheapest possible implementation of this marketing strategy.
More precisely, given a set of points in the plane, find the distance between the closest pair of points provided this distance is less than some limit. If the closest pair is too far apart, marketing will have to opt for some less expensive strategy.
输入
The input file contains several sets of input. Each set of input starts with an integer N ( 0<= N<= 10,000), which denotes the number of points in this set. The next N lines contain the coordinates of N two-dimensional points. The two numbers denote the x- and y-coordinates, respectively. The input is terminated by a set whose N = 0, which should not be processed. All coordinates will have values less than 40,000 and be non-negative.
输出
For each input set, produce a single line of output containing a floating point number (with four digits after the decimal point) which denotes the distance between the closest two points. If there do not exist two points whose distance is less than 10,000, print the line “INFINITY''.
样例输入
For each input set, produce a single line of output containing a floating point number (with four digits after the decimal point) which denotes the distance between the closest two points. If there do not exist two points whose distance is less than 10,000, print the line ``INFINITY''.
样例输出
INFINITY
36.2215
参考代码
暂无
解析
暂无