1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/丑数 III [ugly-number-iii].html

39 lines
1.3 KiB
HTML
Raw 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>丑数是可以被&nbsp;<code>a</code>&nbsp;<strong></strong>&nbsp;<code>b</code>&nbsp;<strong></strong> <code>c</code>&nbsp;整除的 <strong>正整数</strong></p>
<p>给你四个整数:<code>n</code><code>a</code><code>b</code><code>c</code> ,请你设计一个算法来找出第&nbsp;<code>n</code>&nbsp;个丑数。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>n = 3, a = 2, b = 3, c = 5
<strong>输出:</strong>4
<strong>解释:</strong>丑数序列为 2, 3, 4, 5, 6, 8, 9, 10... 其中第 3 个是 4。</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>n = 4, a = 2, b = 3, c = 4
<strong>输出:</strong>6
<strong>解释:</strong>丑数序列为 2, 3, 4, 6, 8, 9, 10, 12... 其中第 4 个是 6。
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>n = 5, a = 2, b = 11, c = 13
<strong>输出:</strong>10
<strong>解释:</strong>丑数序列为 2, 4, 6, 8, 10, 11, 12, 13... 其中第 5 个是 10。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n, a, b, c &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= a * b * c &lt;= 10<sup>18</sup></code></li>
<li>本题结果在&nbsp;<code>[1,&nbsp;2 * 10<sup>9</sup>]</code>&nbsp;的范围内</li>
</ul>