You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
533 B
C++

#include <bits/stdc++.h>
using namespace std;
int a[105];
int main()
{
int T, n, V, W;
scanf("%d", &T);
while (T--)
{
scanf("%d%d%d", &n, &V, &W);
for (int i = 0; i < n; i++) scanf("%d", a + i);
sort(a, a + n);
int sum = 0, cnt = 0;
while (sum + a[cnt] <= W * (cnt + 1) && cnt < n)
sum += a[cnt++];
if (cnt == 0)
puts("0 0.00");
else
printf("%d %.2lf\n", cnt * V, 0.01 * sum / cnt);
}
return 0;
}