1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-04 15:01:40 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
leetcode-problemset/leetcode-cn/problem (Chinese)/判断整除性 [check-divisibility-by-digit-sum-and-product].html
2025-08-10 21:35:14 +08:00

47 lines
1.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个正整数 <code>n</code>。请判断 <code>n</code> 是否可以被以下两值之和&nbsp;<strong>整除</strong></p>
<ul>
<li>
<p><code>n</code>&nbsp;<strong>数字和</strong>(即其各个位数之和)。</p>
</li>
<li>
<p><code>n</code>&nbsp;<strong>数字积</strong>(即其各个位数之积)。</p>
</li>
</ul>
<p>如果 <code>n</code> 能被该和整除,返回 <code>true</code>;否则,返回 <code>false</code></p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">n = 99</span></p>
<p><strong>输出:</strong> <span class="example-io">true</span></p>
<p><strong>解释:</strong></p>
<p>因为 99 可以被其数字和 (9 + 9 = 18) 与数字积 (9 * 9 = 81) 之和 (18 + 81 = 99) 整除,因此输出为 true。</p>
</div>
<p><strong class="example">示例 2</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">n = 23</span></p>
<p><strong>输出:</strong> <span class="example-io">false</span></p>
<p><strong>解释:</strong></p>
<p>因为 23 无法被其数字和 (2 + 3 = 5) 与数字积 (2 * 3 = 6) 之和 (5 + 6 = 11) 整除,因此输出为 false。</p>
</div>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 10<sup>6</sup></code></li>
</ul>