• <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
            亚洲日韩中文无码久久| 女同久久| 久久精品无码一区二区无码 | 亚洲伊人久久精品影院| 久久亚洲国产成人影院| 99久久99久久精品国产片果冻| 久久人妻少妇嫩草AV无码专区| 国产精品美女久久久久| 精品99久久aaa一级毛片| 亚洲人成电影网站久久| 99999久久久久久亚洲| 久久亚洲AV无码西西人体| 无码人妻久久一区二区三区免费 | 国内精品久久九九国产精品| 国产日韩久久久精品影院首页| 亚洲?V乱码久久精品蜜桃| 久久久久久久久无码精品亚洲日韩 | 久久久噜噜噜www成人网| 国产精品美女久久久免费| 囯产精品久久久久久久久蜜桃| 欧美久久精品一级c片片| 久久99热这里只有精品国产| 草草久久久无码国产专区| 久久香蕉超碰97国产精品| 色青青草原桃花久久综合| 亚洲一区二区三区日本久久九| 一本色综合网久久| 亚洲欧美国产日韩综合久久| 91精品国产91久久| 久久精品国产亚洲麻豆| 久久久久高潮毛片免费全部播放| 久久只有这里有精品4| 久久精品视屏| 久久久久亚洲精品中文字幕 | 国产69精品久久久久APP下载| 久久久久一区二区三区| 久久不见久久见免费视频7| 一本色综合网久久| 精品久久人妻av中文字幕| 久久精品中文无码资源站| 婷婷综合久久中文字幕蜜桃三电影|