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

            }


             

             

             

            2021国产精品午夜久久| 无码人妻少妇久久中文字幕蜜桃| 久久久久高潮毛片免费全部播放| 久久久久久亚洲AV无码专区| 国产高潮国产高潮久久久| 国内精品久久久久久久久电影网| 色综合久久88色综合天天 | 久久SE精品一区二区| 精品久久香蕉国产线看观看亚洲| 久久伊人中文无码| 国内精品久久久久影院日本| 久久国产精品免费一区| 久久精品无码午夜福利理论片 | 一本大道加勒比久久综合| 久久久久无码国产精品不卡| 久久影院综合精品| 久久亚洲中文字幕精品一区| 999久久久免费精品国产| 亚洲国产精品综合久久一线 | 久久综合九色综合欧美狠狠| 99久久免费国产精品特黄| 久久久国产精品福利免费| 亚洲欧美日韩久久精品第一区| 久久精品国产精品亚洲艾草网美妙 | 欧美久久一区二区三区| 九九99精品久久久久久| 久久午夜羞羞影院免费观看| 2021国内久久精品| 伊人久久亚洲综合影院| 久久午夜无码鲁丝片午夜精品| 久久精品一区二区| 粉嫩小泬无遮挡久久久久久| 午夜精品久久久久久中宇| 久久人妻AV中文字幕| 中文国产成人精品久久亚洲精品AⅤ无码精品| 久久不见久久见免费视频7| 久久综合88熟人妻| 精品亚洲综合久久中文字幕| 国产精品久久久久AV福利动漫| jizzjizz国产精品久久| 久久精品aⅴ无码中文字字幕不卡|