func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, h, x[2010], fall[2][2010];   double p, dp[2010][2010][2][2];   double solve(int l, int r, int fl, int fr) {     if (l > r) return 0;     if (dp[l][r][fl][fr] != -1) return dp[l][r][fl][fr];     dp[l][r][fl][fr] = 0;     double res = 0;     int nl = min(r, l + fall[0][l] - 1);     if (nl == r) {       if (!fr)         res += (1 - p) * (x[r] - x[l] + min(h, x[r + 1] - x[r] - h));       else         res += (1 - p) * (x[r] - x[l] + min(h, x[r + 1] - x[r]));     } else {       res += (1 - p) * solve(nl + 1, r, 1, fr);       res += (1 - p) * (x[nl] - x[l] + h);     }     if (fl)       res += p * min(h, x[l] - x[l - 1] - h);     else       res += p * min(h, x[l] - x[l - 1]);     res += p * solve(l + 1, r, 0, fr);     int nr = max(l, r - fall[1][r] + 1);     if (nr == l) {       if (fl)         res += p * (x[r] - x[l] + min(h, x[l] - x[l - 1] - h));       else         res += p * (x[r] - x[l] + min(h, x[l] - x[l - 1]));     } else {       res += p * solve(l, nr - 1, fl, 0);       res += p * (x[r] - x[nr] + h);     }     if (!fr)       res += (1 - p) * min(h, x[r + 1] - x[r] - h);     else       res += (1 - p) * min(h, x[r + 1] - x[r]);     res += (1 - p) * solve(l, r - 1, fl, 1);     res /= 2;     return dp[l][r][fl][fr] = res;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(NULL);     cin >> n >> h >> p;     for (int i = (1); i <= (n); i++) cin >> x[i];     x[++n] = 1000000000;     x[++n] = -1000000000;     sort(x + 1, x + n + 1);     fall[1][1] = 1;     for (int i = (2); i <= (n); i++) {       if (x[i] - x[i - 1] < h)         fall[1][i] = fall[1][i - 1] + 1;       else         fall[1][i] = 1;     }     fall[0][n] = 1;     for (int i = (n - 1); i >= (1); i--) {       if (x[i + 1] - x[i] < h)         fall[0][i] = fall[0][i + 1] + 1;       else         fall[0][i] = 1;     }     for (int i = (1); i <= (n); i++)       for (int j = (1); j <= (n); j++)         for (int k = (0); k <= (1); k++)           for (int l = (0); l <= (1); l++) dp[i][j][k][l] = -1;     cout << fixed << setprecision(9) << solve(2, n - 1, 0, 1);     return 0;   }   