标签:style color os io for ar 代码 amp line
思路:排序就可以得到中间数,然后总和和中间数*n比较一下即可
代码:
#include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; const int N = 1005; int n, a[N], sum; int main() { while (~scanf("%d", &n)) { sum = 0; for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); sum += a[i]; } sort(a + 1, a + n + 1); if (a[(n + 1) / 2] * n > sum) printf("YES\n"); else printf("NO\n"); } return 0; }
标签:style color os io for ar 代码 amp line
原文地址:http://blog.csdn.net/accelerator_/article/details/38804097