• <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
            久久97久久97精品免视看| 7777精品久久久大香线蕉| 久久久无码精品亚洲日韩蜜臀浪潮 | 国产成人99久久亚洲综合精品| 久久国产精品成人影院| 亚洲国产美女精品久久久久∴| 午夜精品久久久久久久久| 久久www免费人成看片| 亚洲国产精品无码久久久秋霞2 | 伊人久久大香线蕉精品| 精品国产日韩久久亚洲| 久久99精品久久久久久久久久| 久久免费美女视频| 久久偷看各类wc女厕嘘嘘| 欧美大战日韩91综合一区婷婷久久青草| 久久久久久免费视频| 伊人久久精品线影院| 久久久久这里只有精品| 欧美午夜精品久久久久免费视| 狠狠色丁香久久综合五月| 婷婷久久五月天| 91久久精品视频| 久久精品黄AA片一区二区三区| 久久99亚洲综合精品首页| 亚洲AV日韩精品久久久久久| 欧洲人妻丰满av无码久久不卡| 国产午夜精品理论片久久| 久久99精品国产麻豆| 人妻无码久久精品| 看全色黄大色大片免费久久久| 精品久久久久久中文字幕大豆网| 国内精品久久国产大陆| 无码八A片人妻少妇久久| 国产精品熟女福利久久AV| 久久精品国产亚洲av麻豆小说| 亚洲国产成人乱码精品女人久久久不卡 | 欧美日韩久久中文字幕| 亚洲午夜久久久精品影院| 久久九九精品99国产精品| 综合久久国产九一剧情麻豆| 亚洲狠狠久久综合一区77777|