• <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
            久久精品国产只有精品66| 久久久久成人精品无码中文字幕| 伊人久久无码精品中文字幕| 久久久综合香蕉尹人综合网| 少妇久久久久久被弄到高潮 | 欧美精品九九99久久在观看| 亚洲精品无码久久久久| 久久99热这里只频精品6| 一本一道久久综合狠狠老| 久久久久久人妻无码| 97久久精品人妻人人搡人人玩| 国产午夜福利精品久久| 久久国产色av免费看| 久久精品亚洲欧美日韩久久| 国产欧美久久久精品| 99久久国产亚洲综合精品| 日本久久久久久中文字幕| 久久亚洲国产午夜精品理论片 | 久久久久亚洲精品中文字幕 | 久久不见久久见免费视频7| 久久香蕉国产线看观看99| 四虎国产精品免费久久| 2021最新久久久视精品爱| 久久er国产精品免费观看8| 亚洲综合日韩久久成人AV| 99久久精品国产毛片| 久久精品三级视频| 成人综合伊人五月婷久久| 成人久久综合网| 久久久久国产一级毛片高清板| 亚洲精品无码久久久久sm| 国产精品一久久香蕉产线看| 国产色综合久久无码有码| 久久国产精品久久久| 久久亚洲中文字幕精品一区| 国产成人精品白浆久久69| 久久一本综合| 久久久久人妻一区二区三区| 狠狠久久综合伊人不卡| 婷婷国产天堂久久综合五月| 久久精品国产精品青草app|