mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
38 lines
983 B
HTML
38 lines
983 B
HTML
|
<p>给你一个整数 <code>num</code>,请你找出同时满足下面全部要求的两个整数:</p>
|
|||
|
|
|||
|
<ul>
|
|||
|
<li>两数乘积等于 <code>num + 1</code> 或 <code>num + 2</code></li>
|
|||
|
<li>以绝对差进行度量,两数大小最接近</li>
|
|||
|
</ul>
|
|||
|
|
|||
|
<p>你可以按任意顺序返回这两个整数。</p>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>示例 1:</strong></p>
|
|||
|
|
|||
|
<pre><strong>输入:</strong>num = 8
|
|||
|
<strong>输出:</strong>[3,3]
|
|||
|
<strong>解释:</strong>对于 num + 1 = 9,最接近的两个因数是 3 & 3;对于 num + 2 = 10, 最接近的两个因数是 2 & 5,因此返回 3 & 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> </p>
|
|||
|
|
|||
|
<p><strong>提示:</strong></p>
|
|||
|
|
|||
|
<ul>
|
|||
|
<li><code>1 <= num <= 10^9</code></li>
|
|||
|
</ul>
|