1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-09 09:21:40 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
leetcode-problemset/leetcode-cn/problem (Chinese)/等积子集的划分方案 [partition-array-into-two-equal-product-subsets].html
2025-06-18 01:10:28 +08:00

41 lines
1.8 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>给你一个整数数组 <code>nums</code>,其中包含的正整数&nbsp;<strong>互不相同&nbsp;</strong>,另给你一个整数 <code>target</code></p>
<p>请判断是否可以将 <code>nums</code> 分成两个&nbsp;<strong>非空</strong><strong>互不相交&nbsp;</strong>&nbsp;<strong>子集&nbsp;</strong>,并且每个元素必须 &nbsp;<strong>恰好 </strong>属于&nbsp;<strong>一个&nbsp;</strong>子集,使得这两个子集中元素的乘积都等于 <code>target</code></p>
<p>如果存在这样的划分,返回 <code>true</code>;否则,返回 <code>false</code></p>
<p><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">nums = [3,1,6,8,4], target = 24</span></p>
<p><strong>输出:</strong> <span class="example-io">true</span></p>
<p><strong>解释:</strong>子集 <code>[3, 8]</code><code>[1, 6, 4]</code> 的乘积均为 24。因此输出为 true 。</p>
</div>
<p><strong class="example">示例 2</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">nums = [2,5,3,7], target = 15</span></p>
<p><strong>输出:</strong> <span class="example-io">false</span></p>
<p><strong>解释:</strong>无法将 <code>nums</code> 划分为两个非空的互不相交子集,使得它们的乘积均为 15。因此输出为 false。</p>
</div>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>3 &lt;= nums.length &lt;= 12</code></li>
<li><code>1 &lt;= target &lt;= 10<sup>15</sup></code></li>
<li><code>1 &lt;= nums[i] &lt;= 100</code></li>
<li><code>nums</code> 中的所有元素互不相同。</li>
</ul>