hdu 5003 模拟水题 (2014鞍山网赛G题)

你的一系列得分 先降序排列 再按0.95^(i-1)*ai 这个公式计算你的每一个得分 最后求和

Sample Input
1
2
530 478
Sample Output
984.1000000000

 1 # include <iostream>
 2 # include <cstdio>
 3 # include <algorithm>
 4 # include <map>
 5 # include <cmath>
 6 # define LL long long
 7 using namespace std ;
 8
 9 int a[110] ;
10
11 bool cmp (int x , int y)
12 {
13     return x > y ;
14 }
15
16 int main ()
17 {
18     int T ;
19     scanf("%d" , &T) ;
20     while(T--)
21     {
22         int n ;
23         scanf("%d" , &n) ;
24         int i ;
25         for (i = 1 ; i<=n ;i++)
26             scanf("%d" , &a[i]) ;
27         sort(a+1,a+1+n,cmp) ;
28         double sum = 0 ;
29         for (i = 1 ; i<=n ;i++)
30         {
31             sum+=(pow(0.95,i-1)*a[i]) ;
32         }
33         printf("%.10lf\n" , sum) ;
34     }
35
36     return 0 ;
37 }

时间: 2024-08-27 04:37:12

hdu 5003 模拟水题 (2014鞍山网赛G题)的相关文章

HDU 5003 Osu!(鞍山网络赛G题)

HDU 5003 Osu! 题目链接 就一签到题,排序之后for一遍计算出答案即可 代码: #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> #include <set> #include <map> #include <algorithm> #include <cmat

hdu5074 Hatsune Miku 2014鞍山现场赛E题 水dp

http://acm.hdu.edu.cn/showproblem.php?pid=5074 Hatsune Miku Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 325    Accepted Submission(s): 243 Problem Description Hatsune Miku is a popular vi

HDOJ Osu! 5078【2014鞍山区域赛I题-水】

Osu! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 1263    Accepted Submission(s): 660 Special Judge Problem Description Osu! is a very popular music game. Basically, it is a game about cli

HDU 5073 Galaxy (2014鞍山现场赛D题)

题目链接:HDU 5073 Galaxy 题意:在一维的坐标系里,给出N个点坐标,转动K个点,使转动后这个星系的的惯性最小(根据题意惯性最小也就是 求所有星星到星系中心的距离最小,这个可以理解成方差最小).求最小的惯性. 思路: 先对序列排序,再求出算N-K个点惯性的递推式. 以三个为例: 预处理是 平均数和各项的平方和, 注意:n==k的特判 AC代码: #include <stdio.h> #include <algorithm> using namespace std; do

hdu 5078(2014鞍山现场赛 I题)

数据 表示每次到达某个位置的坐标和时间 计算出每对相邻点之间转移的速度(两点间距离距离/相隔时间) 输出最大值 Sample Input252 1 9//t x y3 7 25 9 06 6 37 6 01011 35 6723 2 2929 58 2230 67 6936 56 9362 42 1167 73 2968 19 2172 37 8482 24 98 Sample Output9.219544457354.5893762558 1 # include <iostream> 2 #

hdu 5053 (2014上海网赛L题 求立方和)

题目大意:给你L到N的范围,要求你求这个范围内的所有整数的立方和. Sample Input2 //T1 32 5 Sample OutputCase #1: 36Case #2: 224 1 # include <iostream> 2 # include <cstdio> 3 # include <cstring> 4 # include <algorithm> 5 # include <cmath> 6 # define LL long l

zoj 3809 枚举水题 (2014牡丹江网赛 A题)

题目大意:给出一列取样的几个山的高度点,求山峰有几个? Sample Input 291 3 2 4 6 3 2 3 151 2 3 4 5Sample Output 30 1 # include <iostream> 2 # include <cstdio> 3 # include <cstring> 4 # include <algorithm> 5 # include <cmath> 6 # define LL long long 7 us

(高斯消元)HDU 5006 Resistance 2014 鞍山网赛

题目链接 题意:有一个电路,用0/1的电阻连接起来.给定两点,问之间的电阻为多少? 先回忆一下中学物理知识,若用并联串联去做,碰到复杂电路根本分析不清.这里用到基尔霍夫定理. 在任一瞬时,流向某一结点的电流之和恒等于由该结点流出的电流之和. 在任一瞬间,沿电路中的任一回路绕行一周,在该回路上电动势之和恒等于各电阻上的电压降之和. 那么我们对于图中的点(电阻为0的看作一个点,缩点)都可以列方程  ∑(Ua-Ub)/Rab =0 Rab都是1所以某条边的电流就等于电压差了. 为了方便求结果,我们设S

hdu5072 Coprime 2014鞍山现场赛C题 计数+容斥

http://acm.hdu.edu.cn/showproblem.php?pid=5072 Coprime Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 354    Accepted Submission(s): 154 Problem Description There are n people standing in a