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

            }


             

             

             

            久久精品一区二区三区AV| 伊人久久大香线蕉影院95| 久久91综合国产91久久精品| 久久99国产精品久久99| 蜜臀av性久久久久蜜臀aⅴ麻豆| 69久久夜色精品国产69| 国产免费福利体检区久久| 欧美久久一区二区三区| 乱亲女H秽乱长久久久| 久久99久国产麻精品66 | 久久精品一区二区影院| 国内精品伊人久久久影院| 人妻精品久久久久中文字幕一冢本| 久久精品国产亚洲AV香蕉| 日韩精品久久久久久免费| 国产精品久久久久久搜索| 国产成人99久久亚洲综合精品 | 精品国际久久久久999波多野| 国产精品成人99久久久久 | 伊人久久大香线蕉AV色婷婷色| 日本精品久久久中文字幕| 97久久精品人妻人人搡人人玩| 亚洲第一永久AV网站久久精品男人的天堂AV| 久久婷婷五月综合97色一本一本 | 一本一本久久A久久综合精品| 精品久久久久久久久久久久久久久 | 99久久夜色精品国产网站 | 国产成人无码精品久久久免费| 色婷婷久久综合中文久久蜜桃av| 久久免费99精品国产自在现线 | 国产91久久精品一区二区| AV无码久久久久不卡蜜桃| 久久人人爽人人爽人人片av麻烦| 久久AⅤ人妻少妇嫩草影院| 久久91亚洲人成电影网站| 999久久久免费精品国产| www性久久久com| 精品久久久久久| 国产亚洲婷婷香蕉久久精品| 国产精品视频久久| 久久久久国产精品|