Cable master(HDU 1551)[一道样例没过但是AC的神奇的题]

Cable master

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9577    Accepted Submission(s): 3208


 

Problem Description
Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the most honest contest ever. It was decided to connect computers for the contestants using a "star" topology - i.e. connect them all to a single central hub. To organize a truly honest contest, the Head of the Judging Committee has decreed to place all contestants evenly around the hub on an equal distance from it.

To buy network cables, the Judging Committee has contacted a local network solutions provider with a request to sell for them a specified number of cables with equal lengths. The Judging Committee wants the cables to be as long as possible to sit contestants as far from each other as possible.

The Cable Master of the company was assigned to the task. He knows the length of each cable in the stock up to a centimeter, and he can cut them with a centimeter precision being told the length of the pieces he must cut. However, this time, the length is not known and the Cable Master is completely puzzled.

You are to help the Cable Master, by writing a program that will determine the maximal possible length of a cable piece that can be cut from the cables in the stock, to get the specified number of pieces.
 
Input
The input consists of several testcases. The first line of each testcase contains two integer numbers N and K, separated by a space. N (1 ≤ N ≤ 10000) is the number of cables in the stock, and K (1 ≤ K ≤ 10000) is the number of requested pieces. The first line is followed by N lines with one number per line, that specify the length of each cable in the stock in meters. All cables are at least 1 centimeter and at most 100 kilometers in length. All lengths in the input are written with a centimeter precision, with exactly two digits after a decimal point.

The input is ended by line containing two 0's.
 
Output
For each testcase write to the output the maximal length (in meters) of the pieces that Cable Master may cut from the cables in the stock to get the requested number of pieces. The number must be written with a centimeter precision, with exactly two digits after a decimal point.

If it is not possible to cut the requested number of pieces each one being at least one centimeter long, then the output must contain the single number "0.00" (without quotes).
 
Sample Input
 
4 11 8.02 7.43 4.57 5.39 0 0
 
Sample Output
 
2.00
 
Source

2001-2002 ACM Northeastern European Regional Programming Contest


问题描述
仙境的居民已决定举行区域编程竞赛。评审委员会自愿提供并承诺组织有史以来最诚实的竞赛。决定使用“星型”拓扑连接参赛者的计算机-即将它们都连接到单个中央集线器。为了组织一场真正诚实的竞赛,评判委员会负责人已下令将所有参赛者均匀地放置在中心周围,并与中心保持相等的距离。

为了购买网络电缆,评审委员会已联系当地的网络解决方案提供商,要求为其出售指定数量的等长电缆。评审委员会希望电缆尽可能长,以使参赛者彼此之间保持尽可能远的距离。

公司的电缆管理员已分配给该任务。他知道库存中每条电缆的长度都可以达到一厘米,并且可以告知厘米他必须切割的长度,因此可以以厘米为单位进行精确切割。但是,这一次,长度是未知的,并且Cable Master完全感到困惑。

您将通过编写一个程序来帮助Cable Master,该程序将确定可以从库存中的电缆上切下的电缆的最大可能长度,以获得指定的电缆数量。
 

输入值
输入包含几个测试用例。每个测试用例的第一行包含两个整数N和K,以空格分隔。 N(1≤N≤10000)是库存中的电缆数,而K(1≤K≤10000)是所需件数。第一行后接N行,每行一个号码,以米为单位指定库存中每条电缆的长度。所有电缆的长度至少为1厘米,最长为100公里。输入中的所有长度均以厘米为精度,小数点后精确两位。

输入以包含两个0的行结束。
 

输出量
对于每个测试用例,在输出中写入Cable Master可以从库存中的电缆上切下的最大长度(以米为单位),以获得所需的数量。该数字必须以厘米为精度,小数点后必须精确地两位。

如果无法削减要求的数量,每个数量至少为一厘米长,则输出必须包含单个数字“ 0.00”(不带引号)。
 

样本输入
4 11
8.02
7.43
4.57
5.39
0 0
 

样本输出
2.00
推荐


和切pie是完全一样的题,唯一奇怪的是我的码求出样例结果是2.01,但是过了...有哪位朋友看到的时候可以指点一下(详见同专题切pie)


猜你喜欢

转载自blog.csdn.net/zstuyyyyccccbbbb/article/details/104883758