• <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
            數(shù)據(jù)加載中……

            從一道簡單題談程序設計的思維

            從一道簡單題談程序設計的思維

            題目

             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

            讀者可先行思考,詳細的分析以后再給出。

            參考資料

            郭嵩山、張子臻、王磊、湯振東著  國際大學生程序設計競賽例題解(五)  電子工業(yè)出版社

            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老熟妇色| 一级做a爰片久久毛片免费陪| 99国产精品久久| 久久99精品久久久久久| 91精品国产91久久久久福利| 久久国产热精品波多野结衣AV| 久久精品中文无码资源站| 国产精品免费福利久久| 国产91久久精品一区二区| 久久99中文字幕久久| 国产AⅤ精品一区二区三区久久 | 国产精品久久国产精品99盘| 99久久国产热无码精品免费| 99久久国产亚洲高清观看2024| 久久高清一级毛片| 97视频久久久| …久久精品99久久香蕉国产| 三级韩国一区久久二区综合| 人妻丰满AV无码久久不卡| 2020最新久久久视精品爱| 中文字幕精品无码久久久久久3D日动漫| 国产美女亚洲精品久久久综合| 狠狠色丁香婷婷综合久久来| 久久免费国产精品| 久久久久亚洲AV无码专区体验| 99久久国产综合精品成人影院| 亚洲一区精品伊人久久伊人| 久久久久亚洲av无码专区导航| 久久久久亚洲AV成人网| 久久精品人人做人人妻人人玩| 久久精品国产亚洲Aⅴ香蕉 | 情人伊人久久综合亚洲| 日本久久中文字幕| 久久综合九色综合久99| 国内精品伊人久久久久av一坑 | jizzjizz国产精品久久| 亚洲国产高清精品线久久 | 狠狠久久亚洲欧美专区| 久久久久久久波多野结衣高潮| 超级碰久久免费公开视频|