1795 Problem A Fibonacci
问题 A: Fibonacci
时间限制: 1 Sec 内存限制: 32 MB
提交: 230 解决: 72
题目描述
The Fibonacci Numbers{0,1,1,2,3,5,8,13,21,34,55...} are defined by the recurrence:
F0=0 F1=1 Fn=Fn-1+Fn-2,n>=2
Write a program to calculate the Fibonacci Numbers.
输入
Each case contains a number n and you are expected to calculate Fn.(0<=n<=30) 。
输出
For each case, print a number Fn on a separate line,which means the nth Fibonacci Number.
样例输入
1
样例输出
1
经验总结
这种题目我就不说话了。。直接上代码0.0
正确代码
#include <cstdio>
const int maxn=60;
int dp[maxn];int main()
{int n;while(~scanf("%d",&n)){dp[0]=0;dp[1]=1;for(int i=2;i<=n;++i){dp[i]=dp[i-1]+dp[i-2];}printf("%d\n",dp[n]);}return 0;
}
1795 Problem A Fibonacci相关推荐
- poj - problem 3070 Fibonacci 【矩阵 +快速幂】
Fibonacci Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13732 Accepted: 9728 Descri ...
- codeup墓地目录(算法笔记习题刷题笔记)
在线codeup contest 地址:http://codeup.cn/contest.php Contest100000575 - <算法笔记>3.1小节--入门模拟->简单模拟 ...
- codeup墓地目录
代码内容为原创C++ 在线codeup contest 地址:http://codeup.cn/contest.php Contest100000575 - <算法笔记>3.1小节--入门 ...
- Blackboard Fibonacci(CF-217B)
Problem Description Fibonacci numbers are the sequence of integers: f0 = 0, f1 = 1, f2 = 1, f3 = 2, ...
- hdu1715 大菲波数
大菲波数 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- HDU1715 大菲波数(大数相加)(Java题解)
大菲波数 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- hdu1715(Java)大数相加
大菲波数 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submissi ...
- HDU 1715 大菲波数
大菲波数 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- The 16th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple
Problem A Vertices in the Pocket 比赛地址:http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?proble ...
最新文章
- kubenetes kubectl命令记录
- Hyperledger Besu(4)身份许可
- 求职特训营火热来袭 阿里大咖教你制作专业简历
- Java多线程学习笔记一
- arm for asterisk1.8
- numpy 中np.max--求序列的最大值和np.maximum--X和Y逐位进行比较,选择最大值
- (14)Verilog数据类型-基本语法(二)(第3天)
- 安装mysql报curses的解决
- Idea快捷键大全(Windows)
- [NOI 2014]起床困难综合症
- Coded UI Test(二)创建一个Coded UI Test
- 小说大纲模板在计算机的哪里,如何撰写小说大纲
- 内部收益率(二分法)
- 中国慕课moocpython答案_中国大学慕课mooc2020用Python玩转数据题目答案
- Image Super Resolution Using Conventional Neural Network (SRCNN)
- 法拉科机器人接头_【发那科】图解FANUC机器人I/O信号板
- 英文打字自动空格如何解决?
- Recorder︱一些图像识别初创公司产品及API搜集ing...
- 基于Hopfield 混沌神经网络和压缩感知的可视化图像加密算法
- justify-content 属性