自爆魂

博客园 首页 新随笔 联系 订阅 管理

中位数是否大于平均数

水题

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
#define RD(x) scanf("%d",&x)
#define RD2(x,y) scanf("%d%d",&x,&y)
#define RD3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define clr0(x) memset(x,0,sizeof(x))
typedef long long LL;
const int maxn = 1<<20;
int s[maxn],n;

int main() {
//	int _;RD(_);while(_--){
//	    ;
//	}
    while(~RD(n)){
        int avg = 0;
        for(int i = 0;i < n;++i){
            RD(s[i]);
            avg += s[i];
        }
        avg /= n;
        sort(s,s+n);
        if(avg < s[(n+1)/2 - 1])
            puts("YES");
        else
            puts("NO");
    }
	return 0;
}


posted on 2014-10-18 22:09  自爆魂  阅读(135)  评论(0编辑  收藏  举报