• <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>
            隨筆 - 6, 文章 - 0, 評論 - 24, 引用 - 0
            數(shù)據(jù)加載中……

            從一道簡單題談程序設計的思維

            從一道簡單題談程序設計的思維

            題目

             Stick
            Problem 

            Anthony has collected a large amount of sticks for manufacturing chopsticks. In order to simplify his job, he wants to fetch two equal-length sticks for machining at a time. After checking it over, Anthony finds that it is always possible that only one stick is left at last, because of the odd number of sticks and some other unknown reasons. For example, Anthony may have three sticks with length 1, 2, and 1 respectively. He fetches the first and the third for machinning, and leaves the second one at last. Your task is to report the length of the last stick.

            Input

            The input file will consist of several cases.
            Each case will be presented by an integer n (1 <= n <= 100, and n is odd) at first. Following that, n positive integers will be given, one in a line. These numbers indicate the length of the sticks collected by Anthony.
            The input is ended by n = 0.

            Output

            For each case, output an integer in a line, which is the length of the last stick.

            Sample Input
            3
            1
            2
            1
            0
            Sample Output
            2

            讀者可先行思考,詳細的分析以后再給出。

            參考資料

            郭嵩山、張子臻、王磊、湯振東著  國際大學生程序設計競賽例題解(五)  電子工業(yè)出版社

            posted on 2009-03-29 15:35 yuyang7 閱讀(2071) 評論(2)  編輯 收藏 引用 所屬分類: 程序設計競賽

            評論

            # re: 從一道簡單題談程序設計的思維  回復  更多評論   

            不錯 LZ加油
            2009-04-03 09:55 | Kven-KeRoX

            # re: 從一道簡單題談程序設計的思維  回復  更多評論   

            xor
            2013-11-18 08:26 | E
            久久精品亚洲日本波多野结衣| 伊人久久大香线蕉无码麻豆| 九九久久99综合一区二区| 丁香久久婷婷国产午夜视频| 免费一级欧美大片久久网| 狠狠色狠狠色综合久久| 国产亚洲美女精品久久久久狼| 久久久精品无码专区不卡| 午夜精品久久久久久久久| 欧美午夜A∨大片久久| 国产99久久精品一区二区| 久久久久亚洲AV无码观看 | 亚洲美日韩Av中文字幕无码久久久妻妇 | 久久久噜噜噜久久熟女AA片| 久久精品国产精品亚洲| 国产精品久久久福利| 91精品国产91久久综合| 国内精品伊人久久久久妇| 国产精品九九久久免费视频| 久久久老熟女一区二区三区| 色青青草原桃花久久综合| 国产香蕉97碰碰久久人人| 97久久精品人妻人人搡人人玩| 麻豆av久久av盛宴av| 亚洲精品97久久中文字幕无码| 久久精品成人免费国产片小草| 草草久久久无码国产专区| 国产精品18久久久久久vr| 精品久久久久久无码专区| 久久综合噜噜激激的五月天| 无码专区久久综合久中文字幕| 综合久久国产九一剧情麻豆| 久久人人爽人人人人片av| 久久99久国产麻精品66| 色综合久久久久久久久五月| 亚洲av伊人久久综合密臀性色 | 91精品国产高清久久久久久国产嫩草| 久久亚洲AV成人无码电影| 国产精品久久久福利| 久久青草国产手机看片福利盒子| 日韩亚洲欧美久久久www综合网 |