• <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国产精| 狠狠人妻久久久久久综合| 久久久久无码精品国产| 国产精品青草久久久久婷婷| 久久中文骚妇内射| 久久久噜噜噜久久| 久久免费的精品国产V∧| 久久精品国产亚洲Aⅴ香蕉| 久久久亚洲AV波多野结衣| 久久久综合九色合综国产| 热久久最新网站获取| 青青草原1769久久免费播放| 亚洲国产成人久久笫一页| 久久久九九有精品国产| 囯产精品久久久久久久久蜜桃 | 久久精品无码一区二区三区免费 | 久久午夜夜伦鲁鲁片免费无码影视 | 久久久久香蕉视频| 99久久免费国产精精品| 久久天天躁狠狠躁夜夜不卡| 久久久久国产| 99国内精品久久久久久久| 久久99国产综合精品免费| 久久久久亚洲精品日久生情| 久久国产免费| 国产亚洲美女精品久久久| 青青草原综合久久大伊人精品| 午夜精品久久久久久久久| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 久久国产精品-国产精品| 久久妇女高潮几次MBA| 一本色道久久88综合日韩精品 | 久久婷婷色香五月综合激情| 精品视频久久久久| 久久国产免费直播| 性高朝久久久久久久久久| 天天综合久久一二三区| 精品久久久久久久久免费影院 | 国产精品国色综合久久| 精品国际久久久久999波多野| 久久综合狠狠综合久久|