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)/和为 K 的最少斐波那契数字数目 [find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-k].html
2022-03-29 12:43:11 +08:00

43 lines
1.2 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>k</code>&nbsp;,请你返回和为&nbsp;<code>k</code>&nbsp;的斐波那契数字的最少数目,其中,每个斐波那契数字都可以被使用多次。</p>
<p>斐波那契数字定义为:</p>
<ul>
<li>F<sub>1</sub> = 1</li>
<li>F<sub>2</sub> = 1</li>
<li>F<sub>n</sub> = F<sub>n-1</sub> + F<sub>n-2</sub>&nbsp; 其中 n &gt; 2 。</li>
</ul>
<p>数据保证对于给定的 <code>k</code>&nbsp;,一定能找到可行解。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>k = 7
<strong>输出:</strong>2
<strong>解释:</strong>斐波那契数字为11235813&hellip;&hellip;
对于 k = 7 ,我们可以得到 2 + 5 = 7 。</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>k = 10
<strong>输出:</strong>2
<strong>解释:</strong>对于 k = 10 ,我们可以得到 2 + 8 = 10 。
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>k = 19
<strong>输出:</strong>3
<strong>解释:</strong>对于 k = 19 ,我们可以得到 1 + 5 + 13 = 19 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= k &lt;= 10^9</code></li>
</ul>