Exercises
Violence must not be over,
But we can blur the divisor, let a part of the number of unity with a divisor, so that can be within the 5% error quickly out of the solution.
Amount, but the previous large section of the movement of the value of the need for violence, or it is difficult to meet 5%.
To a god blog Http://hi.baidu.com/zeonsgtr/item/789da6f2838a3dc742c36ab7
And put a code on it.
#include <cmath> #include <cstdio> #include <cstring> #include <algorithm> #define N 101000# Define EPS 1e-7#define LL long Long using namespace std;int N; LL M[n],sum[n];d ouble a,f[n];int Main () {//freopen ("test.in", "R", stdin); scanf ("%d%lf", &n,&a); for (int i=1;i <=n;i++) scanf ("%lld", &m[i]), sum[i]=sum[i-1]+m[i];for (int i=min (n,2000); i>=1;i--)//violence seeks out the front F-value {int k= (int ) (a*i); if (Fabs (double) (k+1)/a-i) <eps (int k++;for) j=1;j<=k;j++ (double) (f[i]=f[i]+m[i]*m[j]/);} for (int i=2001;i<=n;i++)//Because the topic allows for small errors, we can approximate some of the divisor. {int k= (int) (a*i), mid= (1+k) >>1; f[i]=sum[k]*m[i]/(Double) (i-mid);} for (int i=1;i<=n;i++) printf ("%lf\n", F[i]); return 0;}
"BZOJ1011" "HNOI2008" the distant planets are fuzzy DP based on the allowable error