• <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

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

            參考資料

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

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

            評論

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

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

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

            xor
            2013-11-18 08:26 | E
            久久强奷乱码老熟女| 久久精品国产精品青草app| 久久www免费人成看国产片| 精品国产热久久久福利| 亚洲精品成人网久久久久久| 久久精品国产亚洲AV久| 精品久久一区二区三区| 久久亚洲国产成人影院网站| 久久久一本精品99久久精品88| 久久久九九有精品国产| 亚洲午夜福利精品久久| 日本免费一区二区久久人人澡| 久久夜色精品国产亚洲| 国产综合精品久久亚洲| 久久亚洲日韩精品一区二区三区| 久久久久久极精品久久久| 99久久99久久| 久久综合给合久久狠狠狠97色| 久久精品成人免费观看97| 成人久久精品一区二区三区| 精品国产乱码久久久久久呢| 久久久久亚洲精品男人的天堂| av无码久久久久不卡免费网站| 国产成人AV综合久久| 狠色狠色狠狠色综合久久| 综合久久国产九一剧情麻豆| 亚洲精品综合久久| 久久亚洲天堂| 日本高清无卡码一区二区久久 | 精品一区二区久久久久久久网站| 久久频这里精品99香蕉久| 久久精品国产清自在天天线| 日本一区精品久久久久影院| 99精品国产在热久久| 国产精品久久久久9999| 激情伊人五月天久久综合| 久久精品国产亚洲av水果派| 久久午夜羞羞影院免费观看| 久久久久亚洲AV无码专区体验| 色婷婷综合久久久久中文| 久久99国内精品自在现线|