数学
leagalhigh
never give up!
展开
-
leetcode- Add to List 458. Poor Pigs
考察点:信息论 思路:代码中,n是趟数,result是维度,逐渐增加维度看是否能测出的结构是否大于等于需要的结果。C++:class Solution { public: int poorPigs(int buckets, int minutesToDie, int minutesToTest) { if (buckets == 1) return原创 2017-09-26 14:00:40 · 265 阅读 · 0 评论 -
504 base 7
C++ 代码: 取余数运算;class Solution { public: string convertToBase7(int num) { if (num == 0) { return "0"; } stack<int> sta; int flag = 1; if (num < 0)原创 2017-10-01 10:21:19 · 175 阅读 · 0 评论