编程介的小学生 2017-09-01 01:44 采纳率: 20.5%
浏览 655
已采纳

Body Check

Due to the spread of H1N1 all over the world, the king of Kingdom atouSK is so afraid that he decides to ask all his people to do a body check, no matter how much money it will take. Thus, the king calls up m of the best doctors across the kingdom to finish the task. The docotrs of Kingdom atouSK are selfish. If some of them are asked to work while others of them can take a rest, the docotrs who need to work will get angry and make mistakes at their work time. However, there is one exception, when just one of them needs to work and the others can have a rest, the other doctors will be united and report to the king if the working doctor makes mistakes, so the working doctor needs to do the job alone carefully (How poor!). Therefore, all the m docotrs need to work together or only one of them does the work at certain time.

There are n people in Kingdom atouSK, and it takes different people differnt time to finish the body check. A person can do parts of the check by one doctor and later move to another doctor to continue the check. In other words, a person can do any part of the body check by any docotr at any time, all depending on the doctors' arrangement. But of course, a person CANNOT do the check by two or more doctors at the same time! Suppose the chosen m docotrs are so excellent that they all work at the same efficiency, but they should be focused and each CANNOT check more than one people at the same time.

Though the king doesn't care about the money, he is so concerned about the time to finish all the checks, because the later all the checks finish, the more likely the disease will spread. The king is too busy, so he asks you to calculate the shortest time needed to finish all the body checks.

Input

There may be multiple cases. In each case, there are two integers in the first line, m (0 < m <= 1000) and n (0 < n <= 1000). In the second line, there are n positive real numbers, the ith one indicating the time needed for the ith person to finish the check, not exceeding 1000000.

Output

Output the shortest time needed to finish all the body checks in one line for each case.

Answer having a relative error less than 1e-9 will be accepted.

Sample Input

3 2
1.0 2.0
2 2
1.0 2.0
2 3
1.00 2.0 3.0
Sample Output

3.0000
2.0000
3.0000

  • 写回答

1条回答

  • threenewbee 2017-09-16 15:52
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建