• <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
            久久综合视频网| 久久久久香蕉视频| 久久这里只有精品久久| 国产巨作麻豆欧美亚洲综合久久 | 狠狠色丁香久久婷婷综合_中 | 久久人人爽人人爽人人片AV麻烦 | 久久久久综合中文字幕| 久久受www免费人成_看片中文| 中文字幕久久精品无码| 日本精品久久久久中文字幕8| 久久乐国产综合亚洲精品| 99久久中文字幕| 久久久噜噜噜久久中文字幕色伊伊 | 国产免费福利体检区久久| 人妻精品久久久久中文字幕一冢本| 青青青国产精品国产精品久久久久| 久久精品国产2020| 国产精久久一区二区三区| 99久久精品午夜一区二区| 亚洲中文字幕无码久久2020| 久久一区二区三区免费| 香港aa三级久久三级| 精品久久人妻av中文字幕| 亚洲国产视频久久| 中文字幕久久精品| 热久久视久久精品18| 久久综合一区二区无码| 久久天天躁狠狠躁夜夜2020老熟妇| 青青青青久久精品国产| 国产精品久久毛片完整版| 国产精品久久久久影院嫩草| 精品亚洲综合久久中文字幕| 久久久免费精品re6| 久久久无码人妻精品无码| 91精品国产乱码久久久久久| 久久成人国产精品| 久久久久久久99精品免费观看| a高清免费毛片久久| 久久av无码专区亚洲av桃花岛| 精产国品久久一二三产区区别| 久久精品国产久精国产果冻传媒|