HDU 1157 Who's in the Middle

#include <cstdio>

#include <algorithm>

using namespace std;

int main()

{

    int n;

    while(scanf("%d",&n)!=EOF)

    {

        int a[100000];

        for(int i=0; i<n; i++)

        scanf("%d",&a[i]);

        sort(a,a+n);

        printf("%d\n",a[n/2]);

    }

    return 0;

}

你可能感兴趣的:(HDU)