标签:style io for amp sp size on c return
题解:排序取中位数,然后与平均数比较即可。
#include <cstdio> #include <algorithm> using namespace std; double a[1005],ave,med,sum; int n; int main(){ while(~scanf("%d",&n)){ sum=0; for(int i=1;i<=n;i++){scanf("%lf",&a[i]);sum+=a[i];} sort(a+1,a+n+1); med=a[(n+1)/2]; ave=sum/(double)n; if(med<=ave)puts("NO");else puts("YES"); }return 0; }
标签:style io for amp sp size on c return
原文地址:http://www.cnblogs.com/forever97/p/3937206.html