标签:style blog io color ar os for sp 数据
2 5 2 3.2 4 4.5 6 10 1 2 3 1 2 1.2 3 1.1 1 2
2 5
//每个喷水口最大覆盖长度为:2*sqrt(a[i]*a[i]-1)。
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
bool cmp(double x,double y)
{
return x>y;
}
int main()
{
int test,i,j,n;
double a[610],t;
scanf("%d",&test);
while(test--)
{
scanf("%d",&n);
for(i=0,j=0;i<n;i++)
{
scanf("%lf",&t);
if(t>=1) //如果输入的装置半径小于1,则不存储。
a[j++]=t;
}
double sum=0,k;
sort(a,a+n,cmp);
for(i=0;i<n;i++)
{
if(sum<20){
k=2*sqrt(a[i]*a[i]-1);
sum+=k;}
else
break;
}
printf("%d\n",i);
}
return 0;
}
标签:style blog io color ar os for sp 数据
原文地址:http://blog.csdn.net/hdd871532887/article/details/40838579