1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-22 05:26:46 +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>给你四个整数:<code>n</code> 、<code>a</code> 、<code>b</code> 、<code>c</code> ,请你设计一个算法来找出第 <code>n</code> 个丑数。</p>\n\n<p>丑数是可以被 <code>a</code> <strong>或</strong> <code>b</code> <strong>或</strong> <code>c</code> 整除的 <strong>正整数</strong> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 3, a = 2, b = 3, c = 5\n<strong>输出:</strong>4\n<strong>解释:</strong>丑数序列为 2, 3, 4, 5, 6, 8, 9, 10... 其中第 3 个是 4。</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 4, a = 2, b = 3, c = 4\n<strong>输出:</strong>6\n<strong>解释:</strong>丑数序列为 2, 3, 4, 6, 8, 9, 10, 12... 其中第 4 个是 6。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 5, a = 2, b = 11, c = 13\n<strong>输出:</strong>10\n<strong>解释:</strong>丑数序列为 2, 4, 6, 8, 10, 11, 12, 13... 其中第 5 个是 10。\n</pre>\n\n<p><strong>示例 4</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 1000000000, a = 2, b = 217983653, c = 336916467\n<strong>输出:</strong>1999999984\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= n, a, b, c <= 10^9</code></li>\n\t<li><code>1 <= a * b * c <= 10^18</code></li>\n\t<li>本题结果在 <code>[1, 2 * 10^9]</code> 的范围内</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 98,
"likes": 105,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"7.1K\", \"totalSubmission\": \"27.9K\", \"totalAcceptedRaw\": 7078, \"totalSubmissionRaw\": 27864, \"acRate\": \"25.4%\"}",
"stats": "{\"totalAccepted\": \"7.3K\", \"totalSubmission\": \"28.7K\", \"totalAcceptedRaw\": 7339, \"totalSubmissionRaw\": 28745, \"acRate\": \"25.5%\"}",
"hints": [
"Write a function f(k) to determine how many ugly numbers smaller than k. As f(k) is non-decreasing, try binary search.",
"Find all ugly numbers in [1, LCM(a, b, c)] (LCM is Least Common Multiple). Use inclusion-exclusion principle to expand the result."