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

            評論

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

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

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

            xor
            2013-11-18 08:26 | E
            99re久久精品国产首页2020| 青青青青久久精品国产h久久精品五福影院1421 | 久久人人爽人人爽人人片AV麻烦 | 超级97碰碰碰碰久久久久最新| 亚洲精品乱码久久久久久蜜桃不卡| 国产一久久香蕉国产线看观看| 狠狠色丁香婷婷综合久久来来去| 中文字幕精品久久| 久久久久国产一级毛片高清版| 亚洲欧美精品一区久久中文字幕| 欧美va久久久噜噜噜久久| 国产亚州精品女人久久久久久| 亚洲综合精品香蕉久久网| 国产精品亚洲美女久久久| 亚洲精品乱码久久久久66| 久久国产精品国语对白| 久久久久AV综合网成人| 一级女性全黄久久生活片免费 | 一级做a爱片久久毛片| 日本精品一区二区久久久| 一本大道加勒比久久综合| 久久99精品久久久久久动态图| 一本色道久久88综合日韩精品| 99久久免费国产精品| 2021久久国自产拍精品| 99久久精品国产一区二区| 久久久www免费人成精品| 亚洲精品成人久久久| 欧美日韩精品久久久免费观看| 精品国际久久久久999波多野| 狠狠精品久久久无码中文字幕| 久久这里有精品| 精品伊人久久久| 久久成人国产精品免费软件| 久久国产色av免费看| AV无码久久久久不卡蜜桃| 无码AV波多野结衣久久| 久久久久久国产精品无码超碰| 久久亚洲精精品中文字幕| 人妻少妇久久中文字幕一区二区| 久久综合九色综合网站|