mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 19:31:42 +08:00
add leetcode problem-cn part1
This commit is contained in:
37
算法题(国内版)/problem (Chinese)/最接近的因数 [closest-divisors].html
Normal file
37
算法题(国内版)/problem (Chinese)/最接近的因数 [closest-divisors].html
Normal file
@@ -0,0 +1,37 @@
|
||||
<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>
|
Reference in New Issue
Block a user