标签:blog class code color int c
1011:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 |
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using
namespace std; const
int maxN = 100001; const
double eps = 1e-7; int
n; double
m[maxN],sum[maxN]; double
a; int
main(){ //freopen("cs.in","r",stdin); scanf ( "%d%lf" ,&n,&a); memset (sum,0, sizeof (sum)); for ( register
int i = 1; i <= n; i++){ scanf ( "%lf" ,&m[i]); sum[i] = sum[i-1] + m[i]; int
maxn = ( int ) floor (a*i+eps),len; double
ans = 0; while (maxn){ len = ( int ) floor ((i-maxn)*0.05)+1; if (maxn < len) len = maxn; ans += ( double )(sum[maxn]-sum[maxn-len])/(i-maxn+i-maxn+len-1)*2; maxn -= len; } printf ( "%.6lf\n" ,ans*m[i]); } return
0; } |
标签:blog class code color int c
原文地址:http://www.cnblogs.com/ianaesthetic/p/3717677.html