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

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

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

            題目

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

            評論

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

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

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

            xor
            2013-11-18 08:26 | E
            一本色道久久综合狠狠躁| 久久亚洲欧美日本精品| 热综合一本伊人久久精品| 日韩精品久久久久久久电影| 色综合久久无码五十路人妻| 久久激情亚洲精品无码?V| 久久午夜无码鲁丝片秋霞 | 国产欧美久久久精品| 久久精品国产亚洲7777| 欧美黑人又粗又大久久久| 少妇被又大又粗又爽毛片久久黑人| 久久亚洲精精品中文字幕| 久久久久久国产精品免费免费| 久久综合综合久久综合| 理论片午午伦夜理片久久| 久久国产精品-久久精品| 欧美日韩精品久久免费| 国产综合精品久久亚洲| AV无码久久久久不卡蜜桃 | 久久久久亚洲AV综合波多野结衣 | 无码AV中文字幕久久专区| 国产亚洲美女精品久久久久狼| 亚洲午夜无码AV毛片久久| 久久精品成人免费观看97| 久久99精品国产一区二区三区| 久久只这里是精品66| 久久人人爽人人精品视频| 国产精品99久久久久久www| 久久午夜伦鲁片免费无码| 亚洲伊人久久精品影院 | 国内精品久久久久久99| 久久久免费精品re6| 亚洲αv久久久噜噜噜噜噜| 东方aⅴ免费观看久久av| 狠狠色丁香久久婷婷综合| 久久人妻无码中文字幕| 色8久久人人97超碰香蕉987| 伊人久久综合无码成人网| 免费久久人人爽人人爽av| 亚洲伊人久久精品影院| 国内精品久久久久影院一蜜桃|