Cable master
Time Limit : 2000/1000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 18Accepted Submission(s) : 11
Font:Times New Roman|Verdana|Georgia
Font Size:←→
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
Source
2001-2002 ACM Northeastern European Regional Programming Contest
先开始没读懂题。。后来看懂了之后发现和我做过的那个pi有极其相似的地方,然后果断二分
先开始WA了一次,原因是把最大值搞小了。。然后改了之后就AC了
我的代码:
分享到:
相关推荐
Verilog硬件描述语言编码风格 1. 文件头规定 // **************************************************************************** ...// ---------------------------------------------------------------------------...
hdu-acm源代码(上百题)hdu-acm源代码、hdu-acm源代码hdu-acm源代码
杭电acm解题报告 详细解析2000-2099 适合acm初学者
ACM HDU 2000->2099 解题报告 ACM HDU 2000->2099 解题报告 ACM HDU 2000->2099 解题报告
收集的部分HDOJ杭电ACM题的代码 大牛勿下 全是基础供初级acmer使用
http://acm.hdu.edu.cn/ 杭电 2101-2500 acm的AC解题报告
http://acm.hdu.edu.cn/ 杭电 2051到2099 acm的AC解题报告
2019 Multi-University Training Contest 4(2019hdu多校第六场数据与标程)
6 5518491-A • HDU450-146J1FC 4∼128 S.P,NOTE.8 7 5518492-A • HDU450-72K1FC 4∼128 S.P,NOTE.9 8 2105845-1 • DUMMY CANISTER 0∼124 9 5513938-A • AC BOX(3 PHASE/30A) 2 S.P,NOTE.3 10 5513939-A • AC ...
杭电hdu acm资料所用杭电的acm题
杭电组合博弈课件
acm经典题、结题报告,对初学者非常用用,我就从中学到了很多东西
经典算法:(二分匹配,背包专题,筛选法,简单数学题,贪心算法,递推求解,动态规划,并查集,母函数,搜索,组合博弈等入门算法)
hdu acm 教案 搜索入门 hdu acm 教案 搜索入门
华为HLR相关资料,介绍了HLR中的HDU数据库单元原理
杭电oj4405,一道简单的概率dp题目
ACM-ICPC OJ 解决方案代码 介绍 我的解决方案代码适用于流行的在线裁判系统,例如 POJ、HDOJ、SGU 和 ACM-ICPC Live Archive。 但是,我忘记了我用来解决这些问题的算法!...HDU (HDOJ) 杭州电子科技大学在线评委: :
hdu acm 教案 动态规划(1) hdu acm 教案 动态规划(1)
http://acm.hdu.edu.cn/ 杭电 1861 1862 1863 1864 1867 1868 1870 acm的AC解题报告
自己做的HDU ACM已经AC的题目