• <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>

            ACM___________________________

            ______________白白の屋
            posts - 182, comments - 102, trackbacks - 0, articles - 0
            <2010年10月>
            262728293012
            3456789
            10111213141516
            17181920212223
            24252627282930
            31123456

            常用鏈接

            留言簿(24)

            隨筆分類(332)

            隨筆檔案(182)

            FRIENDS

            搜索

            積分與排名

            最新隨筆

            最新評論

            閱讀排行榜

            評論排行榜

            MiYu原創, 轉帖請注明 : 轉載自 ______________白白の屋    

             

            題目地址:

            http://acm.hdu.edu.cn/showproblem.php?pid=1157 

            題目描述:

            Who's in the Middle

            Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
            Total Submission(s): 2451    Accepted Submission(s): 1204


            Problem Description
            FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as much or more than the median; half give as much or less. 

            Given an odd number of cows N (1 <= N < 10,000) and their milk output (1..1,000,000), find the median amount of milk given such that at least half the cows give the same amount of milk or more and at least half give the same or less.
             

            Input
            * Line 1: A single integer N 

            * Lines 2..N+1: Each line contains a single integer that is the milk output of one cow.
             

            Output
            * Line 1: A single integer that is the median milk output.
             

            Sample Input
            5 2 4 1 3 5
             

            Sample Output
            3
            Hint
            INPUT DETAILS: Five cows with milk outputs of 1..5 OUTPUT DETAILS: 1 and 2 are below 3; 4 and 5 are above 3.
             

             

            水題,  直接代碼 :

             

            /*

            MiYuMiYu 原創, 轉帖請注明 : 轉載自 ______________白白の屋

                      http://www.cnblog.com/MiYu

            Author By : MiYu

            Test      : 1

            Program   : 1157

            */


            #include <iostream>

            #include <algorithm>

            using namespace std;           

            int cow[10010];

            int main ()

            {

                int N;

                while ( cin >> N ){

                       for ( int i = 0; i < N; ++ i ) cin >> cow[i];

                       sort ( cow, cow + N );      

                       cout << cow[N/2] << endl;

                }

                return 0;

            }


             

             

             

            国产99久久久久久免费看| 狠狠色丁香婷婷久久综合五月| 亚洲国产美女精品久久久久∴| 久久免费视频6| 7777精品久久久大香线蕉| 99国产精品久久久久久久成人热| 久久精品国产福利国产秒| 久久一本综合| 精品综合久久久久久888蜜芽| 99久久成人18免费网站| 综合久久精品色| 久久综合久久久| 伊人久久精品无码av一区| 国内精品久久久久影院网站| 亚洲国产精品无码久久一线| 久久se这里只有精品| 色欲综合久久躁天天躁蜜桃| 久久久久亚洲精品无码网址| 99麻豆久久久国产精品免费| 久久亚洲精品无码aⅴ大香| 9191精品国产免费久久| 久久精品欧美日韩精品| 奇米影视7777久久精品人人爽| 精品久久一区二区三区| 亚洲级αV无码毛片久久精品| 久久天天日天天操综合伊人av| 精品国产VA久久久久久久冰| 思思久久精品在热线热| 色婷婷狠狠久久综合五月| 成人a毛片久久免费播放| 国内精品久久久久影院免费| 成人久久综合网| 久久精品国产亚洲av高清漫画| 狠狠综合久久综合88亚洲| 亚洲七七久久精品中文国产| 久久伊人影视| 综合久久给合久久狠狠狠97色 | 久久亚洲av无码精品浪潮| 91麻精品国产91久久久久| 国产精品久久久久久福利漫画| 亚洲αv久久久噜噜噜噜噜|