func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize(2)   using namespace std;   inline long long read() {     long long f = 1, x = 0;     char s = getchar();     while (s <  0  || s >  9 ) {       if (s ==  - ) f = -1;       s = getchar();     }     while (s >=  0  && s <=  9 ) {       x = x * 10 -  0  + s;       s = getchar();     }     return x * f;   }   int zxy = 1e9 + 7;   int n, m, i, j, s, o, k, h;   int a[2005];   int dl[2005], dr[2005];   double dp[2005][2005][2][2], P;   bool f[2005][2005][2][2];   double DP(int l, int r, int f1, int f2) {     if (l > r) return 0.0;     if (f[l][r][f1][f2]) return dp[l][r][f1][f2];     f[l][r][f1][f2] = 1;     double dpp = 0.0;     dpp += 0.5 * P * (min(a[l] - a[l - 1] - h * f1, h) + DP(l + 1, r, 0, f2));     dpp += 0.5 * (1.0 - P) *            (min(a[r + 1] - a[r] - h * f2, h) + DP(l, r - 1, f1, 0));     int L = dr[l], R = dl[r];     if (L < r)       dpp += 0.5 * (1.0 - P) * (a[L] - a[l] + h + DP(L + 1, r, 1, f2));     else       dpp += 0.5 * (1.0 - P) * (a[r] - a[l] + min(a[r + 1] - a[r] - h * f2, h));     if (R > l)       dpp += 0.5 * P * (a[r] - a[R] + h + DP(l, R - 1, f1, 1));     else       dpp += 0.5 * P * (a[r] - a[l] + min(a[l] - a[l - 1] - h * f1, h));     return dp[l][r][f1][f2] = dpp;   }   signed main() {     n = read();     h = read();     scanf( %lf , &P);     for (int i = 1; i <= n; i++) a[i] = read();     sort(a + 1, a + 1 + n);     a[0] = -0x7f7f7f7f;     a[n + 1] = 0x7f7f7f7f;     dr[n] = n;     dl[1] = 1;     for (int i = 2; i <= n; i++) {       if (a[i] - a[i - 1] < h)         dl[i] = dl[i - 1];       else         dl[i] = i;     }     for (int i = n - 1; i > 0; i--) {       if (a[i + 1] - a[i] < h)         dr[i] = dr[i + 1];       else         dr[i] = i;     }     printf( %.10lf n , DP(1, n, 0, 0));     return 0;   }   