• <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
            久久精品国产99国产精品导航| 久久人人爽人人爽人人片AV不| 亚洲欧美精品伊人久久| 国产91久久综合| 久久无码国产专区精品| 久久精品国内一区二区三区| 久久精品女人天堂AV麻| 亚洲中文字幕无码久久2017| 国产精品99久久不卡| 亚洲伊人久久精品影院| 久久99精品九九九久久婷婷| 久久久久人妻一区二区三区vr| 亚洲精品国产成人99久久| 久久这里只有精品18| 青青青青久久精品国产h久久精品五福影院1421 | 中文精品99久久国产 | 久久婷婷色香五月综合激情 | 久久亚洲中文字幕精品一区| 久久综合噜噜激激的五月天| 久久一本综合| 久久久国产一区二区三区| 久久精品国产亚洲网站| 国产精品女同久久久久电影院 | 噜噜噜色噜噜噜久久| 久久精品三级视频| 99久久免费只有精品国产| 久久精品aⅴ无码中文字字幕不卡 久久精品aⅴ无码中文字字幕重口 | 99久久这里只有精品| 97久久婷婷五月综合色d啪蜜芽 | 色综合久久天天综线观看| 狠狠色婷婷综合天天久久丁香 | 久久精品国产精品国产精品污| 亚洲国产日韩综合久久精品| 国内精品久久久久久不卡影院| 国产亚洲综合久久系列| 国内精品伊人久久久久网站| 国产精品久久精品| 97久久超碰国产精品2021| 色天使久久综合网天天| 午夜精品久久久久久中宇| 丁香色欲久久久久久综合网|