当前位置:网站首页>483. Smallest Good Base
483. Smallest Good Base
2022-08-03 21:47:00 【51CTO】
For an integer n, we call k>=2 a good base of n, if all digits of n base k are 1.
Now given a string representing n, you should return the smallest good base of n in string format.
Example 1:
Example 2:
Example 3:
Note:
The range of n is [3, 10^18].
The string representing n is always valid and will not have leading zeros.
思路:
首先完成字符串到数字的转换,然后对于特定的num,当前的最长的其他进制的表示长度是进制为2时的表示长度,就是log2(num)+1(注意:10..0有t个0,那么10..0=2^t)。那么指数i的遍历区间就是[1,log2(num)+1]。对于当前数的当前指数i,可能的base整数取值是num^(1/(i-1))。
边栏推荐
- CAS: 1192802-98-4 _uv cracking of biotin - PEG2 - azide
- StoneDB 开源社区月刊 | 202207期
- CAS: 773888-45-2_BIOTIN ALKYNE_Biotin-alkynyl
- dataframe multi-level index replace index df.swaplevel(axis=1)
- How to deal with commas in the content of the CSV file of the system operation and maintenance series
- Data_web(九)mongodb增量同步到mongodb
- ValidationError: Progress Plugin Invalid Options
- 码率vs.分辨率,哪一个更重要?
- CAS:1797415-74-7_TAMRA-Azide-PEG-Biotin
- 易基因:植物宏病毒组研究:植物病毒的进化与生态 | 顶刊综述
猜你喜欢
随机推荐
【kali-漏洞利用】(3.2)Metasploit基础(上):基础知识
VIM操作
[kali-vulnerability scanning] (2.1) Nessus lifts IP restrictions, scans quickly without results, and plugins are deleted (middle)
三年黑盒测试工程师对嵌入式软件测试的理解
反射机制
Linux操作Jmeter(附带:关于连接上redis无法进行写入操作的问题),JMeter配置多用户进行压力测试
CAS:122567-66-2_DSPE-生物素_DSPE-Biotin
CAS: 773888-45-2_BIOTIN ALKYNE_Biotin-alkynyl
上课笔记(6)(1)——#629. 表达式括号匹配(stack)
nxp官方uboot移植到野火开发板PRO(修改LCD部分和网络部分)
XSS漏洞复现
【kali-漏洞扫描】(2.1)Nessus解除IP限制、扫描快无结果、插件plugins被删除(中)
Cross-end development technical reserve record
好朋友离职了,一周面试了20多场,我直呼内行
Interesting opencv - record image binarization and similarity
CAS:908007-17-0_Biotin-azide_Biotin azide
现网设备兼容SRv6网络演进
码率vs.分辨率,哪一个更重要?
《QDebug 2022年7月》
Data_web(八)mysql增量同步到mongodb









