• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            技術,瞎侃,健康,休閑……

            mahu@cppblog 人類的全部才能無非是時間和耐心的混合物
            posts - 11, comments - 13, trackbacks - 0, articles - 12
              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            Fibonacci Freeze

            Posted on 2006-06-10 01:10 mahudu@cppblog 閱讀(347) 評論(0)  編輯 收藏 引用 所屬分類: C/C++

            The Fibonacci numbers (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...) are defined by the recurrence:

            eqnarray20

            Write a program to calculate the Fibonacci Numbers.

            Input and Output

            The input to your program would be a sequence of numbers smaller or equal than 5000, each on a separate line, specifying which Fibonacci number to calculate.

            Your program should output the Fibonacci number for each input value, one per line.

            Sample Input

            5
            7
            11

            Sample Output

            The Fibonacci number for 5 is 5
            The Fibonacci number for 7 is 13
            The Fibonacci number for 11 is 89

            Solution

            #include <iostream>

            using namespace std;

            ?

            int main()

            {

            ?? int first,next,temp,n;

            ?? while(cin >> n) {

            ????? first = 0;

            ????? next = 1;

            ????? temp = 0;

            ????? if(n == 0 || n == 1) {

            ??????? cout << "The Fibonacci number for" << " " << n << " " << "is" << " " << n << endl;

            ????? }

            ????? else {

            ??????? for(inti = 2; i <= n; i++) {

            ?????????? temp = first + next;

            ?????????? first = next;

            ?????????? next = temp;

            ??????? }

            ??????? cout << "The Fibonacci number for" << " " << n << " " << "is" << " " << temp << endl;

            ????? }

            ?? }

            ?? return 0;

            }

            久久香综合精品久久伊人| 亚洲Av无码国产情品久久| 91精品国产综合久久婷婷| 韩国三级大全久久网站| 色综合合久久天天给综看| 久久婷婷人人澡人人爽人人爱| 亚洲国产精品成人久久| 精品久久久久久久中文字幕| 久久成人国产精品免费软件| 久久婷婷国产麻豆91天堂| 久久久久久伊人高潮影院| 婷婷综合久久狠狠色99h| 亚洲精品国精品久久99热一| 九九久久精品国产| 97久久精品人妻人人搡人人玩| 亚洲欧洲中文日韩久久AV乱码| 久久久久国产一级毛片高清版| 三级三级久久三级久久| 久久久91人妻无码精品蜜桃HD| 韩国免费A级毛片久久| 99久久综合国产精品免费| 久久中文字幕视频、最近更新| 国内精品久久九九国产精品| 国产午夜福利精品久久2021| 少妇久久久久久被弄高潮| 久久精品国产亚洲AV久| 久久久高清免费视频| 久久人妻少妇嫩草AV蜜桃| 日韩亚洲欧美久久久www综合网| 久久久久久久97| 久久精品中文无码资源站| 国产成人久久AV免费| 精品久久久久久| 国产精品综合久久第一页| 7国产欧美日韩综合天堂中文久久久久 | 久久精品国产99久久丝袜| 久久免费精品视频| 国产精品美女久久久久av爽| 伊人丁香狠狠色综合久久| 国产午夜电影久久| 日韩欧美亚洲国产精品字幕久久久 |