C++
1 class Solution{
2 public:
3 /**
4 * @param n: an integer
5 * @return an integer f(n)
6 */
7 int fibonacci(
int n) {
8 // write your code here
9 int a=
0,b=
1;
10 for (
int i=
1; i<n; i++
) {
11 a = a+
b;
12 b = a-
b;
13 }
14 return a;
15 }
16 };
转载于:https://www.cnblogs.com/CheeseZH/p/4998683.html
相关资源:数据结构—成绩单生成器
转载请注明原文地址: https://win8.8miu.com/read-1494628.html