1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/第 N 个神奇数字 [nth-magical-number].html

34 lines
863 B
HTML
Raw Normal View History

2022-03-27 20:46:41 +08:00
<p>一个正整数如果能被 <code>a</code><code>b</code> 整除,那么它是神奇的。</p>
<p>给定三个整数 <code>n</code> ,&nbsp;<code>a</code> , <code>b</code> ,返回第 <code>n</code> 个神奇的数字。因为答案可能很大,所以返回答案&nbsp;<strong>&nbsp;</strong><code>10<sup>9</sup>&nbsp;+ 7</code> <strong>取模&nbsp;</strong>后的值。</p>
<p>&nbsp;</p>
<ol>
</ol>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>n = 1, a = 2, b = 3
<strong>输出:</strong>2
</pre>
<p><strong>示例&nbsp;2</strong></p>
<pre>
<strong>输入:</strong>n = 4, a = 2, b = 3
<strong>输出:</strong>6
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 10<sup>9</sup></code></li>
<li><code>2 &lt;= a, b &lt;= 4 * 10<sup>4</sup></code></li>
</ul>
<p>&nbsp;</p>