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
2022-03-29 12:43:11 +08:00

46 lines
1.4 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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>n</code><code>a</code><code>b</code><code>c</code> ,请你设计一个算法来找出第 <code>n</code> 个丑数。</p>
<p>丑数是可以被 <code>a</code> <strong></strong> <code>b</code> <strong></strong> <code>c</code> 整除的 <strong>正整数</strong></p>
<p> </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><strong>示例 4</strong></p>
<pre>
<strong>输入:</strong>n = 1000000000, a = 2, b = 217983653, c = 336916467
<strong>输出:</strong>1999999984
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= n, a, b, c <= 10^9</code></li>
<li><code>1 <= a * b * c <= 10^18</code></li>
<li>本题结果在 <code>[1, 2 * 10^9]</code> 的范围内</li>
</ul>