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

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

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

            題目

             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
            久久综合中文字幕| 久久久精品日本一区二区三区| 热re99久久精品国产99热| 国产精品一久久香蕉国产线看观看 | 99久久综合狠狠综合久久止| 精品熟女少妇av免费久久| 久久精品国产99国产精偷| 日本福利片国产午夜久久| 久久精品成人欧美大片| 久久久国产打桩机| 久久亚洲国产精品一区二区| 久久久久久噜噜精品免费直播| 久久大香萑太香蕉av| 久久综合给久久狠狠97色| 伊人丁香狠狠色综合久久| 亚洲婷婷国产精品电影人久久| 久久人人爽人人爽人人爽| 久久久女人与动物群交毛片| 国内精品久久久久久不卡影院| 久久精品久久久久观看99水蜜桃| 91精品国产色综合久久| 四虎影视久久久免费观看| 久久av无码专区亚洲av桃花岛| 久久97久久97精品免视看| 亚洲日本va中文字幕久久| 精品人妻伦九区久久AAA片69 | 久久国产精品无码网站| 色婷婷综合久久久久中文| 久久精品一区二区影院| 国内精品久久久久伊人av| 亚洲天堂久久久| 久久精品国产一区二区| 国产成人精品久久免费动漫| 综合久久一区二区三区 | 色欲久久久天天天综合网精品| 亚洲天堂久久精品| 国产精品一区二区久久国产| 久久伊人五月丁香狠狠色| 青青青青久久精品国产h久久精品五福影院1421 | 久久久久人妻一区精品色| 精品久久久中文字幕人妻|