• <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
            數據加載中……

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

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

            題目

             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

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

            參考資料

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

            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
            久久青青草原精品国产不卡| 伊人久久综在合线亚洲2019| 日本久久久久久久久久| 性做久久久久久免费观看| 亚洲精品NV久久久久久久久久| 亚洲午夜无码AV毛片久久| 午夜天堂精品久久久久| 韩国无遮挡三级久久| 无夜精品久久久久久| 色欲久久久天天天综合网| 国产精久久一区二区三区| 久久婷婷五月综合国产尤物app| 久久天天躁狠狠躁夜夜网站 | 久久99精品久久久久久野外| 国内精品伊人久久久久妇| 久久久久亚洲精品天堂| 亚洲精品国产综合久久一线| 精品久久久久久久无码| 女人高潮久久久叫人喷水| 久久综合综合久久97色| 99久久99久久精品国产片果冻 | 亚洲欧洲精品成人久久奇米网| 久久婷婷五月综合97色| 少妇无套内谢久久久久| 精品国产乱码久久久久久浪潮| 久久精品国产亚洲av麻豆小说| 日本WV一本一道久久香蕉| 久久精品无码一区二区三区免费| 久久精品午夜一区二区福利| 久久人人添人人爽添人人片牛牛| 99久久精品免费看国产| 成人精品一区二区久久| 国产日产久久高清欧美一区| 99久久精品日本一区二区免费| 亚洲中文精品久久久久久不卡| 久久综合视频网| 亚洲精品成人久久久| 久久精品国产精品亚洲精品 | 亚洲AV无码久久| 久久影院综合精品| 久久天天躁狠狠躁夜夜avapp|