• <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 閱讀(2060) 評論(2)  編輯 收藏 引用 所屬分類: 程序設計競賽

            評論

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

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

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

            xor
            2013-11-18 08:26 | E
            国产精品久久久久乳精品爆| 久久人人爽人人爽人人片AV麻烦| 亚洲午夜久久久影院伊人| 欧美日韩精品久久免费| AV无码久久久久不卡蜜桃| 久久久久成人精品无码| 久久久婷婷五月亚洲97号色| 精品综合久久久久久88小说| 久久久久久久免费视频| 国产伊人久久| 国产欧美一区二区久久| 亚洲欧美日韩久久精品第一区| 久久精品国产亚洲av麻豆小说| 久久伊人精品青青草原日本| 久久久久久国产精品无码超碰| 欧美色综合久久久久久 | 亚洲国产视频久久| 国产精品VIDEOSSEX久久发布| 久久久精品国产sm调教网站| 久久久久亚洲AV成人网人人网站| 久久久精品视频免费观看| 欧美国产成人久久精品| 无码任你躁久久久久久老妇| 久久亚洲国产精品123区| 久久免费视频一区| 热综合一本伊人久久精品| 女人高潮久久久叫人喷水| 性欧美丰满熟妇XXXX性久久久| 综合久久精品色| 伊人久久精品无码二区麻豆| 香蕉久久av一区二区三区| 国产精品久久久久AV福利动漫| 国产一区二区精品久久岳| 久久综合亚洲鲁鲁五月天| 97久久久精品综合88久久| 久久久久成人精品无码| 2021精品国产综合久久| 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 狠狠色丁香婷婷综合久久来| 久久丝袜精品中文字幕| 色欲久久久天天天综合网|