mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-21 21:16:45 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组 <code>nums</code> 。如果 <code>nums</code> 的一个子集中,所有元素的乘积可以表示为一个或多个 <strong>互不相同的质数</strong> 的乘积,那么我们称它为 <strong>好子集</strong> 。</p>\n\n<ul>\n\t<li>比方说,如果 <code>nums = [1, 2, 3, 4]</code> :\n\n\t<ul>\n\t\t<li><code>[2, 3]</code> ,<code>[1, 2, 3]</code> 和 <code>[1, 3]</code> 是 <strong>好</strong> 子集,乘积分别为 <code>6 = 2*3</code> ,<code>6 = 2*3</code> 和 <code>3 = 3</code> 。</li>\n\t\t<li><code>[1, 4]</code> 和 <code>[4]</code> 不是 <strong>好</strong> 子集,因为乘积分别为 <code>4 = 2*2</code> 和 <code>4 = 2*2</code> 。</li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>请你返回 <code>nums</code> 中不同的 <strong>好</strong> 子集的数目对<em> </em><code>10<sup>9</sup> + 7</code> <strong>取余</strong> 的结果。</p>\n\n<p><code>nums</code> 中的 <strong>子集</strong> 是通过删除 <code>nums</code> 中一些(可能一个都不删除,也可能全部都删除)元素后剩余元素组成的数组。如果两个子集删除的下标不同,那么它们被视为不同的子集。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<b>输入:</b>nums = [1,2,3,4]\n<b>输出:</b>6\n<b>解释:</b>好子集为:\n- [1,2]:乘积为 2 ,可以表示为质数 2 的乘积。\n- [1,2,3]:乘积为 6 ,可以表示为互不相同的质数 2 和 3 的乘积。\n- [1,3]:乘积为 3 ,可以表示为质数 3 的乘积。\n- [2]:乘积为 2 ,可以表示为质数 2 的乘积。\n- [2,3]:乘积为 6 ,可以表示为互不相同的质数 2 和 3 的乘积。\n- [3]:乘积为 3 ,可以表示为质数 3 的乘积。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<b>输入:</b>nums = [4,2,3,15]\n<b>输出:</b>5\n<b>解释:</b>好子集为:\n- [2]:乘积为 2 ,可以表示为质数 2 的乘积。\n- [2,3]:乘积为 6 ,可以表示为互不相同质数 2 和 3 的乘积。\n- [2,15]:乘积为 30 ,可以表示为互不相同质数 2,3 和 5 的乘积。\n- [3]:乘积为 3 ,可以表示为质数 3 的乘积。\n- [15]:乘积为 15 ,可以表示为互不相同质数 3 和 5 的乘积。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= nums[i] <= 30</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 128,
|
||||
"likes": 129,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"15K\", \"totalSubmission\": \"26.3K\", \"totalAcceptedRaw\": 14966, \"totalSubmissionRaw\": 26339, \"acRate\": \"56.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"15.1K\", \"totalSubmission\": \"26.6K\", \"totalAcceptedRaw\": 15085, \"totalSubmissionRaw\": 26558, \"acRate\": \"56.8%\"}",
|
||||
"hints": [
|
||||
"Consider only the numbers which have a good prime factorization.",
|
||||
"Use brute force to find all possible good subsets and then calculate its frequency in nums."
|
||||
|
Reference in New Issue
Block a user