1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-21 21:16:45 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个整数数组&nbsp;<code>nums</code>&nbsp;。如果&nbsp;<code>nums</code>&nbsp;的一个子集中,所有元素的乘积可以表示为一个或多个 <strong>互不相同的质数</strong> 的乘积,那么我们称它为&nbsp;<strong>好子集</strong>&nbsp;。</p>\n\n<ul>\n\t<li>比方说,如果&nbsp;<code>nums = [1, 2, 3, 4]</code>&nbsp;\n\n\t<ul>\n\t\t<li><code>[2, 3]</code>&nbsp;<code>[1, 2, 3]</code>&nbsp;和&nbsp;<code>[1, 3]</code>&nbsp;是 <strong>好</strong>&nbsp;子集,乘积分别为&nbsp;<code>6 = 2*3</code>&nbsp;<code>6 = 2*3</code>&nbsp;和&nbsp;<code>3 = 3</code>&nbsp;。</li>\n\t\t<li><code>[1, 4]</code> 和&nbsp;<code>[4]</code>&nbsp;不是 <strong>好</strong>&nbsp;子集,因为乘积分别为&nbsp;<code>4 = 2*2</code> 和&nbsp;<code>4 = 2*2</code>&nbsp;。</li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>请你返回 <code>nums</code>&nbsp;中不同的&nbsp;<strong>好</strong>&nbsp;子集的数目对<em>&nbsp;</em><code>10<sup>9</sup> + 7</code>&nbsp;<strong>取余</strong>&nbsp;的结果。</p>\n\n<p><code>nums</code>&nbsp;中的 <strong>子集</strong>&nbsp;是通过删除 <code>nums</code>&nbsp;中一些(可能一个都不删除,也可能全部都删除)元素后剩余元素组成的数组。如果两个子集删除的下标不同,那么它们被视为不同的子集。</p>\n\n<p>&nbsp;</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 ,可以表示为互不相同质数 23 和 5 的乘积。\n- [3]:乘积为 3 ,可以表示为质数 3 的乘积。\n- [15]:乘积为 15 ,可以表示为互不相同质数 3 和 5 的乘积。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>1 &lt;= nums[i] &lt;= 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."