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

            }


             

             

             

            伊人色综合久久天天人守人婷 | 国产叼嘿久久精品久久| 亚洲午夜久久久久久久久电影网| 精品国产乱码久久久久久郑州公司 | 久久精品国产亚洲AV不卡| 国内精品久久久久久99蜜桃| 狠狠人妻久久久久久综合蜜桃 | 91精品无码久久久久久五月天| | 久久久久无码国产精品不卡| 久久综合狠狠综合久久综合88| 国内精品久久久久久久涩爱| 久久亚洲精精品中文字幕| 久久一区二区三区99| 国产精品美女久久久久av爽| 久久亚洲AV成人无码国产| 伊人久久五月天| 亚洲欧美成人久久综合中文网| 色综合久久88色综合天天| 奇米综合四色77777久久| 久久九九兔免费精品6| 久久久午夜精品| 伊人久久大香线蕉综合5g| 精品久久久久久久久久中文字幕| 亚洲天堂久久精品| 久久国产乱子伦精品免费午夜| 2021久久国自产拍精品| 嫩草影院久久99| 久久久精品免费国产四虎| 国产精品美女久久久| 久久精品9988| 狠狠色伊人久久精品综合网| 很黄很污的网站久久mimi色| 国产 亚洲 欧美 另类 久久| 久久99国产精品成人欧美| 久久久久18| 狠狠色婷婷久久一区二区| 久久综合狠狠综合久久| 欧美777精品久久久久网| 久久99精品久久久久久9蜜桃| 午夜视频久久久久一区 |