• <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年9月>
            2930311234
            567891011
            12131415161718
            19202122232425
            262728293012
            3456789

            常用鏈接

            留言簿(24)

            隨筆分類(332)

            隨筆檔案(182)

            FRIENDS

            搜索

            積分與排名

            最新隨筆

            最新評論

            閱讀排行榜

            評論排行榜

            MiYu原創(chuàng), 轉(zhuǎn)帖請注明 : 轉(zhuǎn)載自 ______________白白の屋    

             

            題目地址:

            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 原創(chuàng), 轉(zhuǎn)帖請注明 : 轉(zhuǎn)載自 ______________白白の屋

                      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;

            }


             

             

             

            热RE99久久精品国产66热| 久久有码中文字幕| 伊人久久大香线蕉综合Av| 国产精品中文久久久久久久| 久久久久人妻一区精品| 久久人人爽人人爽人人爽| 久久99国产精品尤物| 久久不见久久见免费影院www日本| 99精品国产免费久久久久久下载| 久久久噜噜噜www成人网| 久久天天躁狠狠躁夜夜不卡| 亚洲伊人久久精品影院| 久久99精品久久久久久野外| 久久Av无码精品人妻系列 | 中文字幕乱码人妻无码久久| 大香网伊人久久综合网2020| 亚洲狠狠婷婷综合久久久久| 国产69精品久久久久99| 午夜不卡久久精品无码免费| 99久久综合国产精品免费 | 精品久久久无码中文字幕| 亚洲乱码中文字幕久久孕妇黑人| 久久国产精品-国产精品| 麻豆AV一区二区三区久久| 伊人久久大香线蕉无码麻豆| 久久亚洲国产午夜精品理论片| 久久精品无码午夜福利理论片| 久久综合九色欧美综合狠狠| 精品久久久久中文字幕一区| 久久久久四虎国产精品| 97热久久免费频精品99| 久久精品中文字幕无码绿巨人| 精品国产乱码久久久久久人妻| 久久青青草原精品国产软件 | 精品久久久久久国产| 中文字幕亚洲综合久久菠萝蜜| 久久se精品一区二区影院| 91精品国产91久久| 国产真实乱对白精彩久久| 欧美一级久久久久久久大| 久久国产影院|