标签:else des class 现在 nbsp 剑指offer code cci desc
n<=39
1 class Solution { 2 public: 3 int Fibonacci(int n) { 4 int a,b; 5 a = 1; 6 b = 1; 7 if(n == 0) 8 { 9 return 0; 10 } 11 else if(n == 1) 12 { 13 return 1; 14 } 15 else if(n == 2) 16 { 17 return 1; 18 } 19 else 20 { 21 int c; 22 for(int i = 3;i <= n;++i) 23 { 24 c = a + b; 25 a = b; 26 b = c; 27 } 28 return c; 29 } 30 } 31 };
标签:else des class 现在 nbsp 剑指offer code cci desc
原文地址:https://www.cnblogs.com/Jawen/p/10960835.html