剑指offer 面试题9 求Fibonacci数列
来源:互联网 发布:一个端口 最多连接数 编辑:程序博客网 时间:2024/05/29 13:52
#include <iostream>using namespace std;int fibo_recursion(int n){if(n==0) return 0;if(n==1) return 1;return fibo_recursion(n-1)+fibo_recursion(n-2);} int fibo_ascend(int n){if(n==0) return 0;if(n==1) return 1;int a=0,b=1,c=0;for(int i=1;i<n;++i){c=a+b;a=b;b=c;}return c;}int main(){int num=3;cout<<fibo_recursion(num);cout<<fibo_ascend(num);}
0 0
- 剑指offer 面试题9 求Fibonacci数列
- 剑指offer-面试题9-斐波那契数列(Fibonacci)
- 面试题 9 Fibonacci数列
- 程序员面试题精选--(05)求Fibonacci数列
- [剑指offer]Fibonacci数列
- 【剑指offer】面试题9:斐波那契数列
- 剑指offer 面试题9 斐波那契数列
- 剑指Offer:面试题9 斐波那契数列
- 《剑指Offer》面试题9:裴波那契数列
- 剑指offer-面试题9:斐波那契数列
- 剑指offer 面试题9:斐波那契数列
- 【剑指offer】面试题9:斐波那契数列
- 剑指offer面试题9:裴波那契数列
- 剑指offer--面试题9:斐波那契数列
- 剑指offer:面试题9,斐波那契数列
- 剑指Offer---面试题9:斐波那契数列
- 剑指offer-面试题9-菲波那切数列
- 剑指Offer面试题9斐波那契数列
- 运算放大器
- Linux/Unix 新手和专家教程
- 常用场效应管型号及厂家
- Nand Flash数据存储规则与数据读写方法(一)
- Nand Flash数据存储规则与数据读写方法(二)
- 剑指offer 面试题9 求Fibonacci数列
- Nand Flash数据存储规则与数据读写方法(三)
- python应用--学以致用之计算实时收益
- 常用ARM 网站
- isNAN(),open(),confirm()初识
- Vs2005下载
- 以太网网络变压器的作用
- Platform Builder配置文件详解
- ti 网络资源