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

            評論

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

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

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

            xor
            2013-11-18 08:26 | E
            久久久久成人精品无码 | 中文字幕亚洲综合久久2| 热99RE久久精品这里都是精品免费| 国产精品久久久久乳精品爆| 久久青青草原精品国产不卡 | 亚洲人成无码www久久久| 亚洲Av无码国产情品久久| 久久精品国产2020| 久久久久一区二区三区| 香蕉aa三级久久毛片| 2021久久国自产拍精品| 久久无码人妻精品一区二区三区| 久久天天躁狠狠躁夜夜avapp | 久久久久一本毛久久久| 亚洲AV无码成人网站久久精品大| 久久精品国产影库免费看| 久久久无码精品亚洲日韩京东传媒| 国内精品人妻无码久久久影院| 久久精品成人免费国产片小草| 日韩精品久久无码人妻中文字幕| 婷婷综合久久中文字幕| 新狼窝色AV性久久久久久| 手机看片久久高清国产日韩| www久久久天天com| 伊人久久精品无码av一区| 精品久久久久国产免费| 精品久久香蕉国产线看观看亚洲| 亚洲欧美一区二区三区久久| 国产精品成人99久久久久91gav| 色婷婷综合久久久中文字幕| 久久亚洲国产成人影院网站| 99精品久久久久久久婷婷| 国产精品免费福利久久| 亚洲精品无码久久久久久| 国产免费久久精品99re丫y| 欧洲性大片xxxxx久久久| 国产香蕉97碰碰久久人人| 成人午夜精品久久久久久久小说| 久久久久久久亚洲Av无码| 久久亚洲中文字幕精品有坂深雪 | 久久国产亚洲精品无码|