当前位置:网站首页>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))。
边栏推荐
猜你喜欢
![[3D检测系列-PV-RCNN] PV-RCNN论文详解、PV-RCNN代码复现、包含官网PV-RCNN预训练权重及报错问题](/img/81/c929864440dc36238b3cb1deb9f112.png)
[3D检测系列-PV-RCNN] PV-RCNN论文详解、PV-RCNN代码复现、包含官网PV-RCNN预训练权重及报错问题

idea2021.1.3版本如何启动多个客户端程序

IO thread process -> thread synchronization mutual exclusion mechanism -> day6

反射机制

【使用 Pytorch 实现入门级的人工神经网络】

码率vs.分辨率,哪一个更重要?

CAS:1620523-64-9_Azide-SS-biotin_biotin-disulfide-azide

FVCOM三维水动力、水交换、溢油物质扩散及输运数值模拟丨FVCOM模型流域、海洋水环境数值模拟方法

IO线程进程->线程同步互斥机制->day6

小朋友学C语言(1):Hello World
随机推荐
编译器工程师眼中的好代码(1):Loop Interchange
E-commerce data warehouse ODS layer-----log data loading
What is the role and difference between buildscript and allprojects?
dataframe multi-level index replace index df.swaplevel(axis=1)
FVCOM 3D Numerical Simulation of Hydrodynamics, Water Exchange, Dispersion and Transport of Oil Spills丨FVCOM Model Watershed, Numerical Simulation Method of Marine Water Environment
AI首席架构师13-AICA-智能文档分析技术在行业场景中的应用
今晚直播 | 8.2-8.4 与你聊聊开源与就业那些事!
D - Project Planning--二分
测试2年6.5K,每天“911”,我的心酸经历只有我自己知道···
4. Modular programming
CAS:1260586-88-6_生物素-C5-叠氮_Biotin-C5-Azide
函数,递归以及dom简单操作
码率vs.分辨率,哪一个更重要?
CAS:153162-70-0_N-BOC-6-生物素酰氨基己胺
Zero trust, which has been popular for more than ten years, why can't it be implemented?
ValidationError: Progress Plugin Invalid Options
VIM操作
CAS: 773888-45-2_BIOTIN ALKYNE_Biotin-alkynyl
图神经网络怎么入门?一文带你了解图神经网络入门路径-GNN入门
4. 模块化编程