解题思路

参考这篇博客

$ n = \frac{minutesToTest}{minutesToDie} $ $ m = buckets $ $ \log_nm = \frac{\log_2m}{\log_2n} $
func poorPigs(buckets int, minutesToDie int, minutesToTest int) int {
    return int(
        math.Ceil(
            math.Log(float64(buckets)) / math.Log(float64(minutesToTest) / float64(minutesToDie) + 1)
        )
    )       
}
最后修改日期: 2021年11月25日

作者

留言

撰写回覆或留言

发布留言必须填写的电子邮件地址不会公开。