剑指offer7 斐波那契数列
来源:互联网 发布:时时彩源码搭建教程 编辑:程序博客网 时间:2024/06/06 10:01
提前算好就ok了,因为到第49个就超出int类型的极限了,所以只需要算48就ok了.
#include "iostream"#include "stdio.h"using namespace std;class Solution {public: int Fibonacci(int n) { int num[48]; num[0] = 0; num[1] = 1; num[2] = 1; for(int i=3;i<48;i++) { num[i] = num[i-1]+num[i-2]; } return num[n]; }};int main(){Solution test;int result;result = test.Fibonacci(48);cout<<result<<endl;}
0 0
- 剑指offer7 斐波那契数列
- 斐波那契数列数列计算
- 【剑指offer】斐波那契数列
- 剑指Offer9斐波那契数列
- 剑指offer--斐波那契数列
- 剑指Offer-斐波那契数列
- 剑指offer:斐波那契数列
- 《剑指offer》斐波那契数列
- 剑指 offer:斐波那契数列
- 【剑指Offer】斐波那契数列
- 剑指offer 斐波那契数列
- 【剑指offer】斐波那契数列
- 剑指offer 斐波那契数列
- [剑指offer]斐波那契数列
- 剑指offer06--斐波那契数列
- 剑指offer|斐波那契数列
- 【剑指offer】斐波那契数列
- 剑指Offer_07_斐波那契数列
- 从STORE 然后从客户销售视图中取值
- android select采用代码实现按钮背景
- beyond compare
- OpenStack, OpenDaylight, OpenFlow and Open vSwitch
- 如何开发线程安全的Servlet?
- 剑指offer7 斐波那契数列
- Just Say It!——DNN在语音识别系统中的应用
- CocoaPods 模块管理
- android样式和主题
- android 碎片效果
- Remove Nth Node From End of List 从链表中删除倒数第N的节点
- windows 10 下启动Genymotion报unable to load VirtualBox engine解决方法
- Analysis 3 Functions
- leetcode -- Excel Sheet Column Number -- 简单,但要看