码迷,mamicode.com
首页 > 其他好文 > 详细

童年生活二三事

时间:2018-01-09 22:16:49      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:sys   name   names   log   ret   ++   int   false   www.   

题目:https://www.nowcoder.com/pat/2/problem/256

 1 #include <iostream>
 2 #include <algorithm>
 3 using namespace std;
 4 const int  maxn = 92;
 5 long long f[maxn];
 6 
 7 void db(){
 8     f[1] = 1;
 9     f[2] = 2;
10     for (int i = 3; i < maxn; i++){
11         f[i] = f[i - 1] + f[i - 2];
12     }
13 }
14 
15 int main(){
16     std::ios::sync_with_stdio(false);
17     int n;
18     db();
19     while (cin >> n){
20         cout << f[n] << endl;
21     }
22     //system("pause");
23     return 0;
24 }

 

童年生活二三事

标签:sys   name   names   log   ret   ++   int   false   www.   

原文地址:https://www.cnblogs.com/jaydenouyang/p/8253802.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!