• <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
            国产成人无码精品久久久免费 | 久久只这里是精品66| 国产精品成人久久久久三级午夜电影 | 热久久这里只有精品| 久久精品成人欧美大片| 一级做a爰片久久毛片看看| 色偷偷88888欧美精品久久久| 久久久久亚洲av无码专区导航| 国产午夜免费高清久久影院| 久久精品中文字幕第23页| 波多野结衣AV无码久久一区| 99久久精品这里只有精品| 久久只有这里有精品4| 久久国产精品-久久精品| 久久国产高清一区二区三区| 一本色道久久综合亚洲精品| 99久久精品国产毛片| 午夜精品久久久久久99热| 精品国产一区二区三区久久蜜臀| 97精品依人久久久大香线蕉97 | 丁香五月综合久久激情| 欧美日韩精品久久免费| 99热都是精品久久久久久| 久久天天躁狠狠躁夜夜96流白浆| 久久国产视屏| 国产成人精品久久亚洲高清不卡 国产成人精品久久亚洲高清不卡 国产成人精品久久亚洲 | 久久国产精品波多野结衣AV| 亚洲精品乱码久久久久久久久久久久 | 2020最新久久久视精品爱| 久久精品国产亚洲av麻豆色欲| 久久久噜噜噜久久| 国产精品99久久不卡| 99久久国产综合精品五月天喷水| 久久精品无码午夜福利理论片| 97久久婷婷五月综合色d啪蜜芽 | 久久人妻无码中文字幕| 日韩中文久久| 久久久久久久久久久久久久| 久久久久99这里有精品10| 久久久午夜精品福利内容| 久久香综合精品久久伊人|