首页 > TAG信息列表 > leetcode458

leetcode458 可怜的小猪

思路: 数学。 实现: class Solution { public: int poorPigs(int buckets, int minutesToDie, int minutesToTest) { int base=minutesToTest/minutesToDie+1; double eps=1e-8; return ceil(log(buckets)/log(base)-eps); } };