hdu-1157 Who's in the Middle
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
int n,m,i,j,t;
int a[10010];
while(~scanf("%d",&n))
{
for(i=0;i<n;i++)
scanf("%d",&a[i]);
sort(a,a+n);
printf("%d\n",a[n/2]);
}
return 0;
} 忽然之间发现多知道几个函数还是有好处的,省掉了好多的麻烦,这个代码用c提交未通过,用c++和g++通过,貌似这些代码已不仅仅是c语言了。。。

浙公网安备 33010602011771号