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)/最接近的因数 [closest-divisors].html

38 lines
983 B
HTML
Raw Normal View History

2022-03-27 20:37:52 +08:00
<p>给你一个整数&nbsp;<code>num</code>,请你找出同时满足下面全部要求的两个整数:</p>
<ul>
<li>两数乘积等于 &nbsp;<code>num + 1</code>&nbsp;&nbsp;<code>num + 2</code></li>
<li>以绝对差进行度量,两数大小最接近</li>
</ul>
<p>你可以按任意顺序返回这两个整数。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>num = 8
<strong>输出:</strong>[3,3]
<strong>解释:</strong>对于 num + 1 = 9最接近的两个因数是 3 &amp; 3对于 num + 2 = 10, 最接近的两个因数是 2 &amp; 5因此返回 3 &amp; 3 。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>num = 123
<strong>输出:</strong>[5,25]
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>num = 999
<strong>输出:</strong>[40,25]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= num &lt;= 10^9</code></li>
</ul>