• <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
            亚洲美日韩Av中文字幕无码久久久妻妇| 久久成人18免费网站| 亚洲人成无码网站久久99热国产| 日韩va亚洲va欧美va久久| 久久久久久午夜精品| 久久99热精品| 久久婷婷五月综合成人D啪| 精品久久无码中文字幕| 久久无码AV中文出轨人妻| 久久综合国产乱子伦精品免费| 久久成人永久免费播放| 久久久无码精品亚洲日韩蜜臀浪潮| 97久久精品无码一区二区| 色播久久人人爽人人爽人人片AV| 99久久国产热无码精品免费| 热久久最新网站获取| 久久夜色tv网站| 久久久亚洲欧洲日产国码二区| www亚洲欲色成人久久精品| 色综合久久中文字幕无码| 久久一区二区免费播放| 国产精品免费久久久久电影网| 日产精品久久久一区二区| 综合久久精品色| 伊人久久大香线蕉综合网站| 久久国产热这里只有精品| 丁香五月综合久久激情| 久久国产精品99国产精| 亚洲午夜久久久久妓女影院| 婷婷久久综合| 欧美久久久久久午夜精品| 精品久久久久国产免费| 国产精品综合久久第一页| 青青青青久久精品国产h| 久久亚洲精品视频| 国产精品九九久久免费视频 | 久久综合亚洲鲁鲁五月天| 亚洲日韩欧美一区久久久久我| 色综合久久中文字幕综合网| 亚洲国产综合久久天堂 | 亚洲国产精久久久久久久|