杭电2070
2016-07-29 16:07
351 查看
/*此题主要注意数组类型注意内存主函数若用递归协会超时,因为for循环过大n平方所以用递推式学习动态规划后只需将动态转移方程写出来即可*/
*/
#include<iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; __int64 a[100]; int main() { int fn1, fn2; __int64 n; while(scanf("%I64d", &n) != EOF && n != -1){ a[0] = 0; a[1] = 1; for(int i = 2; i <= n; i++){ a[i] = a[i - 1] + a[i - 2];//代码主要在这里 推出动态方程即可 } cout << a << endl; } return 0; }
*/
相关文章推荐
- C#新手入门代码 使用readline时不输入而是敲击回车,之后用convert转换类型出现错误的解决代码
- Eclipse智能提示及快捷键
- 2016 Multi-University Training Contest 4 T9
- MS SQL的存储过程
- sitemesh3-springMVC配置
- Java Notes: Java的this和static
- Java Notes: Java的this和static
- Java Notes: Java的this和static
- MongoChef malformed UTF-8 character sequence at offset 89
- PHP FTP 文件上传
- Java Notes: Java的this和static
- Java Notes: Java的this和static
- Java Notes: Java的this和static
- Java Notes: Java的this和static
- 史上最全github使用方法:github入门到精通
- JSF导航
- Android自定义view01-ScrollView嵌套GridView
- h.264编码中level是什么含义,值的大小决定了什么?
- 使用Octave分析GNU Radio的数据
- JSP PDF打印 随记