• <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
            中文字幕乱码久久午夜| 国产精品久久久久影视不卡| 久久99热这里只频精品6| 久久青青色综合| 国产99精品久久| 日日狠狠久久偷偷色综合0| 一本一本久久A久久综合精品| 国产成人精品白浆久久69| 久久久久这里只有精品| 国内精品久久久人妻中文字幕| 久久国产综合精品五月天| 久久久久AV综合网成人| 久久精品夜色噜噜亚洲A∨ | 久久综合伊人77777麻豆| 亚洲精品无码久久久影院相关影片| 一级做a爱片久久毛片| 久久免费的精品国产V∧| 亚洲国产精品无码久久久久久曰 | 国产精品久久久久9999| 亚洲精品无码久久久久AV麻豆| 国内精品久久久久久99| 久久综合亚洲欧美成人| 国产精品成人久久久| 老司机午夜网站国内精品久久久久久久久 | 亚洲国产精品成人久久蜜臀| 色综合久久久久网| 97久久香蕉国产线看观看| 99久久这里只精品国产免费| 久久涩综合| 久久久久国产视频电影| 国产69精品久久久久99| 97久久天天综合色天天综合色hd | 国产成人精品久久二区二区| 久久这里只有精品18| 99久久精品免费看国产一区二区三区| 久久国产福利免费| 久久91精品综合国产首页| 成人亚洲欧美久久久久| 久久最新免费视频| 亚洲中文字幕无码久久2020| 亚洲人成网亚洲欧洲无码久久 |