HDU5003-Osu!-AsiaRegionalAnshanOnline2014

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5003

#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<map>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#include<vector>
#include<algorithm>
#define LL long long
#define inf 1<<29
#define s(a) scanf("%d",&a)
#define CL(a,b) memset(a,b,sizeof(a))
using namespace std;
const int N=2005;
int n,m,a[N],b,c;
bool cmp(int a,int b){return a>b;}
int main()
{
    int t;
    s(t);
    while(t--){
        s(n);
        double sum=0;
        for(int i=1;i<=n;i++) s(a[i]);
        sort(a+1,a+n+1,cmp);
        for(int i=1;i<=n;i++){
            double tmp=1;
            for(int j=0;j<i-1;j++) tmp*=0.95;
            sum+=tmp*a[i];
        }
        printf("%.10lf\n",sum);
    }
    return 0;
}


 

你可能感兴趣的:(HDU5003)