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)/第 N 个泰波那契数 [n-th-tribonacci-number].html
2022-03-29 12:43:11 +08:00

32 lines
853 B
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>泰波那契序列&nbsp;T<sub>n</sub>&nbsp;定义如下:&nbsp;</p>
<p>T<sub>0</sub> = 0, T<sub>1</sub> = 1, T<sub>2</sub> = 1, 且在 n &gt;= 0&nbsp;的条件下 T<sub>n+3</sub> = T<sub>n</sub> + T<sub>n+1</sub> + T<sub>n+2</sub></p>
<p>给你整数&nbsp;<code>n</code>,请返回第 n 个泰波那契数&nbsp;T<sub>n </sub>的值。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>n = 4
<strong>输出:</strong>4
<strong>解释:</strong>
T_3 = 0 + 1 + 1 = 2
T_4 = 1 + 1 + 2 = 4
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>n = 25
<strong>输出:</strong>1389537
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 &lt;= n &lt;= 37</code></li>
<li>答案保证是一个 32 位整数,即&nbsp;<code>answer &lt;= 2^31 - 1</code></li>
</ul>