码迷,mamicode.com
首页 > 其他好文 > 详细

[LeetCode] Minimize Max Distance to Gas Station 最小化去加油站的最大距离

时间:2018-04-29 01:18:18      阅读:320      评论:0      收藏:0      [点我收藏+]

标签:tput   加油站   example   HERE   possible   length   ssi   max   line   

 

On a horizontal number line, we have gas stations at positions stations[0], stations[1], ..., stations[N-1], where N = stations.length.

Now, we add K more gas stations so that D, the maximum distance between adjacent gas stations, is minimized.

Return the smallest possible value of D.

Example:

Input: stations = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], K = 9
Output: 0.500000

Note:

  1. stations.length will be an integer in range [10, 2000].
  2. stations[i] will be an integer in range [0, 10^8].
  3. K will be an integer in range [1, 10^6].
  4. Answers within 10^-6 of the true value will be accepted as correct.

 

s

 

[LeetCode] Minimize Max Distance to Gas Station 最小化去加油站的最大距离

标签:tput   加油站   example   HERE   possible   length   ssi   max   line   

原文地址:https://www.cnblogs.com/grandyang/p/8970057.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!