// This question was made for one night // a very simple DP water question. At first it timed out and then wa again after optimization. The result showed that the output accuracy was insufficient, at least four digits after the decimal point must be output. // preprocessing is required first, otherwise, there will be a lot of repeated computations in the DP process. // set DP [I] to complete a [1] +... + minimum time of a [I], after cost [I] [J] is the slave station I tire replacement, time required for arrival J // DP [I] = min (DP [k] + cost [k] [I] + B ), 0 <k <I/dp [0] = 0; # include <iostream> # include <cstdio> using namespace STD; const int n = 105; const int M = 10005; const int INF = 1000000000; double DP [N]; double cost [N] [N]; double total [m]; int record [N]; int A [n]; int N, R; doubl E v, E, F, B; double CAL (INT X) {If (x> = r) return 1/(V-E * (X-R )); elsereturn 1/(V-f * (R-x);} int main () {A [0] = 0; int Maxx, mini; while (CIN> N & N) {Maxx =-INF; For (INT I = 1; I <= N; I ++) {CIN> A [I]; DP [I] = inf; Maxx = max (Maxx, a [I]);} CIN> B; cin> r> V> E> F; Total [0] = CAL (0); For (INT I = 1; I <= Maxx; I ++) total [I] = total [I-1] + CAL (I); For (INT I = 0; I <= N; I ++) for (Int J = I + 1; j <= N; J ++) cost [I] [J] = total [A [J]-A [I]-1]; DP [0] = 0; record [0] = 0; For (INT I = 1; I <= N; I ++) for (int K = 0; k <I; k ++) if (K! = 0) DP [I] = min (DP [I], DP [k] + cost [k] [I] + B ); elsedp [I] = min (DP [I], DP [k] + cost [k] [I]); printf ("%. 4lf \ n ", DP [N]);} return 0 ;}