1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-12 08:55:14 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
leetcode-problemset/leetcode-cn/problem (Chinese)/计算十进制表示 [compute-decimal-representation].html
2025-09-29 14:48:40 +08:00

54 lines
1.9 KiB
HTML
Raw Permalink 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>给你一个&nbsp;<strong>正整数&nbsp;</strong><code>n</code></p>
<p>如果一个正整数可以表示为 1 到 9 的单个数字和 10 的非负整数次幂的乘积,则称这个整数是一个&nbsp;<strong>10 进制分量</strong>。例如500、30 和 7 是&nbsp;<strong>10 进制分量&nbsp;</strong>,而 537、102 和 11 则不是。</p>
<p>请将&nbsp;<code>n</code>&nbsp;表示为若干&nbsp;<strong>仅由&nbsp;</strong>10 进制分量组成的和,且使用的 10 进制分量个数&nbsp;<strong>最少&nbsp;</strong></p>
<p>返回一个包含这些&nbsp;<strong>10 进制分量 </strong>的数组,并按分量大小&nbsp;<strong>降序&nbsp;</strong>排列。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">n = 537</span></p>
<p><strong>输出:</strong><span class="example-io">[500,30,7]</span></p>
<p><strong>解释:</strong></p>
<p>我们可以将 537 表示为<code>500 + 30 + 7</code>。无法用少于 3 个 10 进制分量表示 537。</p>
</div>
<p><strong class="example">示例 2</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">n = 102</span></p>
<p><strong>输出:</strong><span class="example-io">[100,2]</span></p>
<p><strong>解释:</strong></p>
<p>我们可以将 102 表示为<code>100 + 2</code>。102 不是一个 10 进制分量,因此需要 2 个 10 进制分量。</p>
</div>
<p><strong class="example">示例 3</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">n = 6</span></p>
<p><strong>输出:</strong><span class="example-io">[6]</span></p>
<p><strong>解释:</strong></p>
<p>6 是一个 10 进制分量。</p>
</div>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 10<sup>9</sup></code></li>
</ul>