题解
2023-05-27 17:21:25
发布于:上海
26阅读
0回复
0点赞
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
float Tri(float radius , float width){
return 2*sqrt(radius*radius - width*width);
}
bool cmp(float a,float b){
return a>b;
}
int main(){
int m,n;
float a[601], sum,temp;
cin>>m;
while (m--){
sum = 0.0;
cin>>n;
for (int i = 0; i < n; i++){
scanf("%f", &a[i]);
}
sort(a,a+n,cmp);
for (int i = 0; i < n; i++){
sum += (Tri(a[i],1.0));
if (sum >= 20){
cout<<i+1<<endl;
break;
}
}
}
return 0;
}
这里空空如也
有帮助,赞一个