标签:blog io os for 2014 sp log on c
水。。
#include <iostream> #include <cstdio> #include <string.h> #include <queue> #include <vector> #include <algorithm> #include <set> using namespace std; #define N 100 double a[N]; bool cmp(double x, double y){ return x>y; } int n; double quick(double x, int y){ double ans = 1.0; while(y){ if(y&1) ans *= x; y >>= 1; x *= x; } return ans; } void solve(){ scanf("%d",&n); for(int i = 1; i <= n; i++)scanf("%lf",&a[i]); sort(a+1, a+n+1, cmp); double ans = 0; for(int i = 1; i <= n; i++) { ans += quick(0.95, i-1) * a[i]; } printf("%.10f\n",ans); } int main(){ int T;scanf("%d",&T); while(T--){ solve(); } return 0; }
HDU 5003 Osu! 水题 2014 ACM/ICPC Asia Regional Anshan Online
标签:blog io os for 2014 sp log on c
原文地址:http://blog.csdn.net/qq574857122/article/details/39253139