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

            從一道簡單題談程序設(shè)計的思維

            從一道簡單題談程序設(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

            讀者可先行思考,詳細的分析以后再給出。

            參考資料

            郭嵩山、張子臻、王磊、湯振東著  國際大學生程序設(shè)計競賽例題解(五)  電子工業(yè)出版社

            posted on 2009-03-29 15:35 yuyang7 閱讀(2071) 評論(2)  編輯 收藏 引用 所屬分類: 程序設(shè)計競賽

            評論

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

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

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

            xor
            2013-11-18 08:26 | E
            亚洲国产成人精品久久久国产成人一区二区三区综 | 亚洲中文精品久久久久久不卡| 91精品国产综合久久香蕉| 国产亚洲精久久久久久无码AV| 天天爽天天爽天天片a久久网| 久久er国产精品免费观看8| 欧美亚洲国产精品久久高清| 亚洲国产精品无码久久一线 | 狠狠色丁香久久婷婷综合五月| 日韩精品久久久久久| 超级碰碰碰碰97久久久久| 99麻豆久久久国产精品免费| 久久久久噜噜噜亚洲熟女综合| 亚洲精品蜜桃久久久久久| 99久久精品免费看国产一区二区三区| 久久久久亚洲av毛片大| 久久久久久亚洲精品成人| 日韩美女18网站久久精品| 国产精品久久自在自线观看| 欧美精品乱码99久久蜜桃| 99久久精品国产毛片| 久久国产精品成人片免费| 2021国产精品久久精品| 99久久www免费人成精品| 丰满少妇人妻久久久久久| 久久亚洲精品无码VA大香大香| 国产成人精品久久亚洲高清不卡 | 国内精品伊人久久久久777| 国产精品伦理久久久久久| 久久福利青草精品资源站| 欧美噜噜久久久XXX| 超级碰碰碰碰97久久久久| 色99久久久久高潮综合影院| 久久本道综合久久伊人| 久久精品国产亚洲Aⅴ蜜臀色欲| 久久久91精品国产一区二区三区| 久久er99热精品一区二区| 国产成人久久精品激情| 国产91久久精品一区二区| 99久久99久久久精品齐齐| 国产精品无码久久综合|