hdu acm steps 1.3.8

题目:http://acm.hdu.edu.cn/showproblem.php?pid=1157

排序找中间那个数

下面是AC代码:

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

}


 

你可能感兴趣的:(hdu acm steps 1.3.8)