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)/k-avoiding 数组的最小总和 [determine-the-minimum-sum-of-a-k-avoiding-array].html
2023-08-20 20:47:46 +08:00

34 lines
1.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

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>k</code></p>
<p>对于一个由 <strong>不同</strong> 正整数组成的数组,如果其中不存在任何求和等于 k 的不同元素对,则称其为 <strong>k-avoiding</strong> 数组。</p>
<p>返回长度为 <code>n</code><strong>k-avoiding</strong> 数组的可能的最小总和。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<pre>
<strong>输入:</strong>n = 5, k = 4
<strong>输出:</strong>18
<strong>解释:</strong>设若 k-avoiding 数组为 [1,2,4,5,6] ,其元素总和为 18 。
可以证明不存在总和小于 18 的 k-avoiding 数组。
</pre>
<p><strong class="example">示例 2</strong></p>
<pre>
<strong>输入:</strong>n = 2, k = 6
<strong>输出:</strong>3
<strong>解释:</strong>可以构造数组 [1,2] ,其元素总和为 3 。
可以证明不存在总和小于 3 的 k-avoiding 数组。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n, k &lt;= 50</code></li>
</ul>