• <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 閱讀(345) 評論(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;

            }

            久久久免费观成人影院 | 亚洲午夜无码久久久久小说| 99久久精品国产一区二区| 亚洲色欲久久久久综合网| 久久强奷乱码老熟女网站| 久久久久久无码Av成人影院| 久久精品男人影院| 久久久久国产精品嫩草影院| 久久99精品国产自在现线小黄鸭| 四虎国产精品免费久久5151 | 久久久高清免费视频| 久久久久久毛片免费播放| 久久综合视频网站| 精品熟女少妇a∨免费久久| 久久久久亚洲精品男人的天堂| 久久精品成人欧美大片| 久久久久久久国产免费看| 精品久久久无码人妻中文字幕豆芽| 欧洲国产伦久久久久久久| 99久久精品九九亚洲精品| 久久久久亚洲精品天堂| 国产精品久久久久蜜芽| 久久久久久A亚洲欧洲AV冫| 久久国产精品无码一区二区三区| 理论片午午伦夜理片久久| 国产毛片久久久久久国产毛片| 国产成人精品免费久久久久| 婷婷五月深深久久精品| 久久久久久久免费视频| 久久综合色之久久综合| 国产精品免费久久久久影院| 久久不射电影网| 99久久婷婷国产综合精品草原| 精品综合久久久久久888蜜芽| 麻豆成人久久精品二区三区免费 | 99热热久久这里只有精品68| 久久精品aⅴ无码中文字字幕不卡| 国产亚洲精久久久久久无码77777| 亚洲午夜精品久久久久久浪潮| 97精品伊人久久大香线蕉| 久久天天躁夜夜躁狠狠|