package
Version:
v0.0.0-...-5ea41ec
Opens a new window with list of versions in this module.
Published: Jun 12, 2025
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
哈沙德数
如果一个整数能够被其各个数位上的数字之和整除,则称之为** 哈沙德数**(Harshad number)。给你一个整数 x 。如果 x 是 **哈沙德数 **,则返回__x 各个数位上的数字之和,否则,返回__-1 。
示例 1:
**输入:**x = 18
**输出:**9
解释:
x 各个数位上的数字之和为 9 。18 能被 9 整除。因此 18 是哈沙德数,答案是 9 。
示例 2:
**输入:**x = 23
输出:-1
解释:
x 各个数位上的数字之和为 5 。23 不能被 5 整除。因此 23 不是哈沙德数,答案是 -1 。
提示:
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.