标签:style blog color io os ar for 数据 2014
2 5 2 3.2 4 4.5 6 10 1 2 3 1 2 1.2 3 1.1 1 2
2 5
#include<cstdio> #include<math.h> #include<algorithm> using namespace std; bool cmp(double a,double b) { return a>b; } int main() { double a[1000]={0}; int T,n,i,j,k; while(~scanf("%d",&T)) { while(T--) { scanf("%d",&n); for(i=0;i<n;i++) { scanf("%lf",&a[i]); } sort(a,a+n,cmp); double p,s=0; p=sqrt(404)/2; for(i=0;i<n;i++) { if(a[i]>=1) s+=a[i]; if(s>=p) break; } printf("%d\n",i+1); } } return 0; }
标签:style blog color io os ar for 数据 2014
原文地址:http://blog.csdn.net/holyang_1013197377/article/details/39457391