Error DP (what ghost)
Read the question (the error does not exceed%5 is also counted) This sentence is really no egg use, but this is the key to solve the problem, because the two distant planets to the answer is very small contribution,
So we can make part of the unification divided by a length, in order to ensure the accuracy of the requirements, the previous part of the violent calculation, so it can be over
1 #defineMAXN 100010UL2#include <cmath>3#include <cstdio>4#include <algorithm>5 #defineEPS 1e-76 7 using namespacestd;8 9typedefLong Longll;Ten One intN; A ll SUM[MAXN], M[MAXN]; - DoubleA, F[MAXN]; - the intMain () { -scanf"%D%LF", &n, &A); - for(inti =1; I <= N; + + i) scanf ("%lld", &m[i]), sum[i] = m[i]+sum[i-1]; - for(inti =1, r = min ( -, n); I <= R; ++i) { + intK = (int) (i*A); - if(Fabs (k +1)/a-i) (<eps) + +K; + for(intj =1; J <= K; + + j) F[i] + = m[i]*m[j]/(Double) (I-j); A } at for(inti =2001; I <= N; ++i) { - intK = (int) (i*a), Mid = (1+K) >>1; -F[i] = sum[k]*m[i]/(Double) (I-mid); - } - for(inti =1; I <= N; + + i) printf ("%lf\n", F[i]); - return 0; in}
View Code
Bzoj 1011 Distant Planets