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

            評論

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

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

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

            xor
            2013-11-18 08:26 | E
            亚洲香蕉网久久综合影视 | 91精品国产综合久久四虎久久无码一级| 久久青青草视频| 蜜臀久久99精品久久久久久小说| 久久婷婷国产综合精品| 久久精品国产亚洲av麻豆色欲| 久久精品亚洲精品国产色婷| 久久免费精品视频| 日韩欧美亚洲国产精品字幕久久久| 要久久爱在线免费观看| 久久精品欧美日韩精品| 国产精品欧美久久久久无广告| 色欲综合久久躁天天躁| 人妻精品久久无码专区精东影业| 国产婷婷成人久久Av免费高清| 久久久久久国产a免费观看不卡| 亚洲综合伊人久久综合| 一本色道久久88加勒比—综合| 精品久久久久久久久免费影院| 国产精品久久久久久影院 | 久久精品一区二区三区中文字幕| 久久久亚洲欧洲日产国码是AV| 久久99精品国产麻豆不卡| 亚洲欧美伊人久久综合一区二区| 四虎久久影院| 精品久久久久中文字| 久久99精品久久久久久hb无码| 狠狠色丁香久久婷婷综合图片| 7国产欧美日韩综合天堂中文久久久久| 久久久久久久女国产乱让韩| 国内精品伊人久久久久网站| 久久久久99精品成人片欧美| 久久人人爽人人爽人人片AV高清| 久久精品国产99久久香蕉| 国产精品久久久久久久| 久久久九九有精品国产| 久久久久人妻一区二区三区vr| 久久久久久精品免费免费自慰| 久久精品国产99国产精品| 久久久WWW成人免费毛片| 久久久人妻精品无码一区|