http://acm.hdu.edu.cn/showproblem.php?pid=2570

    1. #include<bits/stdc++.h>
    2. using namespace std;
    3. int c;
    4. bool cmp(double a,double b){
    5. return a<b;
    6. }
    7. int main(){
    8. while(~scanf("%d",&c)&&c){
    9. for(int i=0;i<c;i++){
    10. int n,v,w;
    11. scanf("%d%d%d",&n,&v,&w);
    12. double p[150];
    13. for(int j=0;j<n;j++){
    14. scanf("%lf",&p[j]);
    15. }
    16. sort(p,p+n,less<double>());
    17. int cnt = 0;
    18. double resp = 0.0;
    19. for(int i=0;i<n;i++){
    20. double tmp = (resp*cnt+p[i]/100.0)/(cnt+1);
    21. // cout << tmp << endl;
    22. if(tmp<=w/100.0) resp = tmp,cnt++;
    23. else break;
    24. }
    25. if(cnt){
    26. printf("%d %.2lf\n",cnt*v,resp);
    27. }
    28. else printf("0 0.00\n");
    29. }
    30. }
    31. return 0;
    32. }