1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/判断一个数是否迷人 [check-if-the-number-is-fascinating].html
2023-06-12 23:05:37 +08:00

36 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>&nbsp;</p>
<p>如果经过以下修改得到的数字 <strong>恰好</strong>&nbsp;包含数字 <code>1</code>&nbsp;<code>9</code>&nbsp;各一次且不包含任何 <code>0</code>&nbsp;,那么我们称数字 <code>n</code>&nbsp;<strong>迷人的</strong>&nbsp;</p>
<ul>
<li>&nbsp;<code>n</code>&nbsp;与数字&nbsp;<code>2 * n</code>&nbsp;<code>3 * n</code>&nbsp;<strong>连接</strong>&nbsp;</li>
</ul>
<p>如果 <code>n</code>&nbsp;是迷人的,返回&nbsp;<code>true</code>,否则返回&nbsp;<code>false</code>&nbsp;</p>
<p><strong>连接</strong>&nbsp;两个数字表示把它们首尾相接连在一起。比方说&nbsp;<code>121</code>&nbsp;<code>371</code>&nbsp;连接得到&nbsp;<code>121371</code>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><b>输入:</b>n = 192
<b>输出:</b>true
<b>解释:</b>我们将数字 n = 192 2 * n = 384 和 3 * n = 576 连接,得到 192384576 。这个数字包含 1 到 9 恰好各一次。
</pre>
<p><strong>示例 2</strong></p>
<pre><b>输入:</b>n = 100
<b>输出:</b>false
<b>解释:</b>我们将数字 n = 100 2 * n = 200 和 3 * n = 300 连接,得到 100200300 。这个数字不符合上述条件。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>100 &lt;= n &lt;= 999</code></li>
</ul>