#include<algorithm>
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int compare(const float &a, const float &b)
{
return a>b;
}
int num(int n,float c)
{
int num =0;
float *a = new float[600];
for(int i=0; i<n; i++)
scanf("%f",&a[i]);
sort(a, a+n,compare);
for(int i=0; i<n; i++)
{
if(c<0)break;
else {
c-=2*a[i];
num++;
}
}
printf("%d\n",num);
}
int main()
{
int n, m;
scanf("%d",&n);
while(n--)
{
scanf("%d",&m);
num(m,20);
}
system("pause");
return 0;
}
喷水装置 简单的贪心
最新推荐文章于 2024-08-19 23:14:35 发布