483. Smallest Good Base
来源:互联网 发布:淘宝旺铺版本区别 编辑:程序博客网 时间:2024/05/24 02:50
http://blog.csdn.net/hanzheng992/article/details/54879692
class Solution(object):
def smallestGoodBase(self, n):
"""
:type n: str
:rtype: str
"""
num = int(n)
thisLen = int(math.log(num,2)) + 1
while thisLen > 2:
# from equation [3], we havve
thisBase = int(num ** (1.0/(thisLen - 1)))
# from equation [2], we have
if num * (thisBase - 1) == thisBase ** thisLen - 1:
return str(thisBase)
thisLen -= 1
return str(num - 1)
阅读全文
0 0
- 483. Smallest Good Base
- 483. Smallest Good Base
- 483. Smallest Good Base
- 483. Smallest Good Base
- 483. Smallest Good Base
- leetCode 483. Smallest Good Base
- [leetcode]483. Smallest Good Base
- leetcode题解-483. Smallest Good Base
- [Leetcode] 483. Smallest Good Base 解题报告
- leetcode 483. Smallest Good Base 二分查找
- Smallest Good Base
- LeetCode 483 Smallest Good Base 解题报告
- LeetCode 483 Smallest Good Base 题解
- leetcode483. Smallest Good Base 的一些思考
- Leetcode 483 - Smallest Good Base(二分+枚举)
- good blog about android base
- A good code base of Microsoft C#
- trac - good web-base software project management tool
- 安装my5.7
- 全局函数
- Ubuntu下 vi编辑方向键变成ABCD
- opencv+Qt5 知识点
- 感想
- 483. Smallest Good Base
- BZOJ 4518: [Sdoi2016]征途 斜率优化
- 速Geometric.Stackup.2.1.0.15228公差分析
- Windows下的nginx配置
- 关于startActivityForResult无法拿到回传信息
- Python绘制点线
- Android中的接口回调
- PathClassLoader && DexClassLoader
- apache ab 压力测试