原题
这题的重点是使用思维方式。例如,任意一个数组,若它的中位数大于等于m,那么这一串数字中,比m大的数字一定比m小的数字多,多多少不清楚,至少多一,那么,就让它多一,那么,这题就会很简单了。注意,这里必须是每个子序列的中位数均大于等于m。
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int MX=1e5+9;
int n,m;
int main()
{
//freopen("input.txt","r",stdin);
while( ~scanf("%d %d",&n,&m) ){
int a=0,b=0,k;
while( n-- ){
scanf("%d",&k);
if( k>=m )
a++;
else
b++;
}
printf("%d\n",max(a-b,0));
}
return 0;
}