• <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精品| 久久久久国产精品| 国产精品成人99久久久久| 久久久受www免费人成| 久久婷婷五月综合97色直播| 久久国产亚洲高清观看| 精品久久人人做人人爽综合| 国产69精品久久久久APP下载| 久久婷婷五月综合国产尤物app| 国产一区二区三区久久| 亚洲国产成人精品久久久国产成人一区二区三区综 | 97久久精品人人做人人爽| 婷婷久久综合九色综合绿巨人| 久久精品无码专区免费青青 | 亚洲中文字幕无码久久综合网 | 久久精品国产99国产精品澳门 | 精品久久久久久久国产潘金莲 | 国产一区二区精品久久凹凸| 久久无码中文字幕东京热| 国产精品亚洲综合专区片高清久久久| 久久久久久国产精品无码下载| 久久99精品免费一区二区| 97久久精品午夜一区二区| 亚洲精品乱码久久久久久按摩| 狠狠人妻久久久久久综合| 成人国内精品久久久久一区| 国产精品久久新婚兰兰| 久久人人爽人人爽人人片AV麻豆 | 潮喷大喷水系列无码久久精品| 伊人久久大香线蕉AV一区二区 | 国产精品热久久毛片| 国产精品久久久久久福利漫画 | 国产一级持黄大片99久久| 亚洲αv久久久噜噜噜噜噜| 久久天天躁狠狠躁夜夜不卡| 热久久国产欧美一区二区精品| 国产激情久久久久影院| 国产精品一区二区久久精品无码| 一级做a爰片久久毛片16| 91久久香蕉国产熟女线看|