• <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年11月>
            31123456
            78910111213
            14151617181920
            21222324252627
            2829301234
            567891011

            常用鏈接

            留言簿(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;

            }


             

             

             

            日本亚洲色大成网站WWW久久| 人妻少妇久久中文字幕一区二区| 99久久99这里只有免费费精品| 久久人人爽人人爽人人片av麻烦| 亚洲精品乱码久久久久久久久久久久 | 久久久精品国产Sm最大网站| 久久人搡人人玩人妻精品首页| 亚洲国产小视频精品久久久三级| 久久精品国产亚洲av影院| 国产成人AV综合久久| 亚洲精品无码久久不卡| www久久久天天com| 久久久久人妻一区精品| 伊人久久久AV老熟妇色| 久久精品成人欧美大片| 97r久久精品国产99国产精| 久久久无码人妻精品无码| 亚洲天堂久久精品| 久久亚洲私人国产精品| 久久经典免费视频| 99久久国产亚洲高清观看2024| 7777精品久久久大香线蕉| 国产成人综合久久久久久| 久久久精品人妻一区二区三区蜜桃| 狠狠人妻久久久久久综合蜜桃| 欧美黑人激情性久久| 一级做a爰片久久毛片免费陪| 精品久久久久久无码中文野结衣| …久久精品99久久香蕉国产 | 久久综合视频网| 久久精品中文字幕有码| 精品久久久久久无码国产 | 日日狠狠久久偷偷色综合0| 成人亚洲欧美久久久久| 久久久久人妻一区二区三区vr| 色综合久久久久综合体桃花网| 久久久久亚洲AV成人网人人网站| 久久亚洲国产精品成人AV秋霞 | 久久婷婷五月综合国产尤物app| 香蕉久久永久视频| 国内精品久久久久影院薰衣草 |