• <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年8月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            常用鏈接

            留言簿(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国产一区二区三区| 国产91色综合久久免费分享| 久久久久久毛片免费播放| 97精品伊人久久久大香线蕉 | 国产精品9999久久久久| 色综合久久88色综合天天| 精品久久久久久99人妻| 精品国产乱码久久久久软件| 色综合久久中文字幕无码| 久久99久久成人免费播放| 久久久久se色偷偷亚洲精品av| .精品久久久麻豆国产精品| 开心久久婷婷综合中文字幕| 久久超乳爆乳中文字幕| 亚洲美日韩Av中文字幕无码久久久妻妇| 色婷婷综合久久久久中文| 久久综合久久鬼色| 97久久久精品综合88久久| 久久WWW免费人成一看片| 久久www免费人成精品香蕉| 国产精品美女久久久久| 久久精品人人做人人爽电影| 丁香久久婷婷国产午夜视频| 777米奇久久最新地址| 久久精品亚洲AV久久久无码| 香蕉久久夜色精品国产尤物| 日本精品久久久久中文字幕| AAA级久久久精品无码片| 久久久久久久久波多野高潮| 欧美日韩精品久久久久| 国产69精品久久久久9999| 狠狠干狠狠久久| 久久久久久久尹人综合网亚洲| 蜜臀av性久久久久蜜臀aⅴ| 久久人人爽人人爽人人片AV东京热| 久久中文字幕精品| 中文精品99久久国产| 亚洲国产精品综合久久网络| 亚洲AⅤ优女AV综合久久久| 伊人久久五月天|