当前位置:网站首页>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:1260586-88-6_生物素-C5-叠氮_Biotin-C5-Azide
- VIM操作
- How to deal with commas in the content of the CSV file of the system operation and maintenance series
- 深度学习怎么入门?零基础快速入门深度学习
- 【Unity3D】Tank对战
- 2022年全国职业院校技能大赛网络安全 B模块 B-1任务一:主机发现与信息收集 国赛原题
- VLAN实验
- 反射机制
- 云图说丨初识华为云微服务引擎CSE
- IO thread process -> thread synchronization mutual exclusion mechanism -> day6
猜你喜欢

基于DMS的数仓智能运维服务,知多少?

一体化HTAP数据库如此难,为什么他们还要做?

如何基于WPF写一款数据库文档管理工具(二)

解决npm -v查看npm版本出现npm WARN config global `--global`, `--local` are deprecated. Use `--location报错

CAS: 773888-45-2_BIOTIN ALKYNE_Biotin-alkynyl

开源一夏 |如何优化线上服务器

XSS漏洞复现

Pay from 0 to 1

小朋友学C语言(1):Hello World

Engineering Effectiveness Governance for Agile Delivery
随机推荐
6. XML
Use setTimeout to realize setInterval
『百日百题 · 基础篇』备战面试,坚持刷题 第四话——循环语句!
安全基础8 ---XSS
《强化学习周刊》第56期:GraphIRL、REDEEMER & 眼科强化学习的潜在研究
nxp官方uboot移植到野火开发板PRO(无任何代码逻辑的修改)
函数,递归以及dom简单操作
剑指 Offer 16. 数值的整数次方
ValidationError: Progress Plugin Invalid Options
ES、Kibana 8.0安装
A. Color the Picture- Codeforces Round #810 (Div. 1)
386. Lexicographical Numbers
基于支持向量机的网络⼊侵检测系统的全面调查和分类
一体化HTAP数据库如此难,为什么他们还要做?
[3D检测系列-PV-RCNN] PV-RCNN论文详解、PV-RCNN代码复现、包含官网PV-RCNN预训练权重及报错问题
如何基于WPF写一款数据库文档管理工具(二)
STP生成树
跨端开发技术储备记录
服务器安装redis
385. Mini Parser