mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-11 18:31:41 +08:00
55 lines
2.0 KiB
HTML
55 lines
2.0 KiB
HTML
<p>给你一个数字数组 <code>digits</code>,你需要从中选择三个数字组成一个三位偶数,你的任务是求出 <strong>不同 </strong>三位偶数的数量。</p>
|
||
|
||
<p><strong>注意</strong>:每个数字在三位偶数中都只能使用 <strong>一次 </strong>,并且 <strong>不能 </strong>有前导零。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong class="example">示例 1:</strong></p>
|
||
|
||
<div class="example-block">
|
||
<p><strong>输入:</strong> <span class="example-io">digits = [1,2,3,4]</span></p>
|
||
|
||
<p><strong>输出:</strong> <span class="example-io">12</span></p>
|
||
|
||
<p><strong>解释:</strong> 可以形成的 12 个不同的三位偶数是 124,132,134,142,214,234,312,314,324,342,412 和 432。注意,不能形成 222,因为数字 2 只有一个。</p>
|
||
</div>
|
||
|
||
<p><strong class="example">示例 2:</strong></p>
|
||
|
||
<div class="example-block">
|
||
<p><strong>输入:</strong> <span class="example-io">digits = [0,2,2]</span></p>
|
||
|
||
<p><strong>输出:</strong> <span class="example-io">2</span></p>
|
||
|
||
<p><strong>解释:</strong> 可以形成的三位偶数是 202 和 220。注意,数字 2 可以使用两次,因为数组中有两个 2 。</p>
|
||
</div>
|
||
|
||
<p><strong class="example">示例 3:</strong></p>
|
||
|
||
<div class="example-block">
|
||
<p><strong>输入:</strong> <span class="example-io">digits = [6,6,6]</span></p>
|
||
|
||
<p><strong>输出:</strong> <span class="example-io">1</span></p>
|
||
|
||
<p><strong>解释:</strong> 只能形成 666。</p>
|
||
</div>
|
||
|
||
<p><strong class="example">示例 4:</strong></p>
|
||
|
||
<div class="example-block">
|
||
<p><strong>输入:</strong> <span class="example-io">digits = [1,3,5]</span></p>
|
||
|
||
<p><strong>输出:</strong> <span class="example-io">0</span></p>
|
||
|
||
<p><strong>解释:</strong> 无法形成三位偶数。</p>
|
||
</div>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>3 <= digits.length <= 10</code></li>
|
||
<li><code>0 <= digits[i] <= 9</code></li>
|
||
</ul>
|