• <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
            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            常用鏈接

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

            }


             

             

             

            国产精品18久久久久久vr| 人妻无码精品久久亚瑟影视| 日产精品久久久久久久| 好久久免费视频高清| 一本久久精品一区二区| 日本高清无卡码一区二区久久| 国内精品人妻无码久久久影院导航| 国产精品久久久久9999高清| 99久久亚洲综合精品网站| 88久久精品无码一区二区毛片 | 久久久久国产| 热久久国产欧美一区二区精品| 亚洲精品国产美女久久久| 国产三级久久久精品麻豆三级| 亚洲精品无码久久久久sm| 国内精品久久人妻互换| 精品视频久久久久| 亚洲AV无码成人网站久久精品大| 国内精品久久久久国产盗摄| 日产精品99久久久久久| 国产精品VIDEOSSEX久久发布| 久久无码高潮喷水| 亚洲国产成人久久综合碰碰动漫3d | 亚洲AV无一区二区三区久久| 少妇内射兰兰久久| 久久精品国产男包| 国产亚洲美女精品久久久2020| 久久国产高清字幕中文| 国内精品久久久久久麻豆| 国产高潮久久免费观看| 久久噜噜电影你懂的| 久久久久久久精品成人热色戒| 久久久久亚洲AV成人网人人网站 | 日韩久久无码免费毛片软件| 亚洲人成电影网站久久| 7777精品伊人久久久大香线蕉 | 亚洲国产成人精品91久久久 | 九九久久99综合一区二区| 久久精品中文字幕第23页| 免费一级欧美大片久久网| 国産精品久久久久久久|