func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2020;   int prv[N], nxt[N], n;   long long h, x[N];   int px[N], nx[N], pxa[N], nxa[N];   bool mark[N][N][4];   double p, dp[N][N][4];   void prep() {     for (int i = n - 1; i >= 0; i--) {       if (i + 1 == n || x[i + 1] - x[i] >= h) {         nxa[i] = h;         nxt[i] = i;       } else {         nxt[i] = nxt[i + 1];         nxa[i] = min(h, x[i + 1] - x[i]);       }       if (i + 1 == n)         nx[i] = h;       else if (x[i + 1] - x[i] >= 2 * h)         nx[i] = h;       else         nx[i] = max(0LL, x[i + 1] - x[i] - h);     }     for (int i = 0; i < n; i++) {       if (i == 0 || x[i] - x[i - 1] >= h) {         pxa[i] = h;         prv[i] = i;       } else {         pxa[i] = min(h, x[i] - x[i - 1]);         prv[i] = prv[i - 1];       }       if (i == 0)         px[i] = h;       else if (x[i] - x[i - 1] >= 2 * h)         px[i] = h;       else         px[i] = max(0LL, x[i] - x[i - 1] - h);     }   }   double f(int l, int r, int mask) {     if (l > r) return 0;     if (l == r) {       int h1 = pxa[l], h2 = nxa[l];       if (mask & 1) h1 = px[l];       if (mask & 2) h2 = nx[l];       return p * h2 + (1.0 - p) * h1;     }     double &ret = dp[l][r][mask];     if (mark[l][r][mask]) return ret;     int nxtr = min(r, nxt[l]);     int h1 = nxa[nxtr];     if (mask & 2 && nxtr == r) h1 = nx[nxtr];     ret += p * ((x[nxtr] - x[l] + h1) + f(nxtr + 1, r, mask | 1));     h1 = pxa[l];     if (mask & 1) h1 = px[l];     ret += (1.0 - p) * (h1 + f(l + 1, r, mask & 2));     ret /= 2.0;     int prvl = max(l, prv[r]);     h1 = pxa[prvl];     if (mask & 1 && prvl == l) h1 = px[prvl];     double ret2 = (1.0 - p) * ((x[r] - x[prvl] + h1) + f(l, prvl - 1, mask | 2));     int hh = nxa[r];     if (mask & 2) hh = nx[r];     ret2 += p * (hh + f(l, r - 1, mask & 1));     ret2 *= 0.5;     ret += ret2;     mark[l][r][mask] = true;     return ret;   }   int main(void) {     ios::sync_with_stdio(false);     cin >> n >> h >> p;     p = 1.0 - p;     for (int i = 0; i < n; i++) cin >> x[i];     sort(x, x + n);     prep();     printf( %.11lf n , f(0, n - 1, 0));     return 0;   }   