首页 > 其他 > 详细

[LeetCode] Poor Pigs 可怜的猪

时间:2017-10-14 01:14:14      阅读:283      评论:0      收藏:0      [点我收藏+]

 

There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. They all look the same. If a pig drinks that poison it will die within 15 minutes. What is the minimum amount of pigs you need to figure out which bucket contains the poison within one hour.

Answer this question, and write an algorithm for the follow-up general case.

Follow-up:

If there are n buckets and a pig drinking poison will die within m minutes, how many pigs (x) you need to figure out the "poison" bucket within p minutes? There is exact one bucket with poison.

 

s

 

[LeetCode] Poor Pigs 可怜的猪

原文:http://www.cnblogs.com/grandyang/p/7664088.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!