func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1000;   int from[MAXN + 5];   void Gauss(int n, int d, double a[][MAXN + 5], double *Ans) {     for (int i = 1; i <= n; i++) from[i] = i;     for (int i = 1; i <= n; i++) {       if (!a[i][i])         for (int j = i + 1; j <= min(n, i + d); j++)           if (a[i][j]) {             for (int k = max(1, i - d); k <= min(n, i + d); k++)               swap(a[k][i], a[k][j]);             swap(from[i], from[j]);             break;           }       for (int j = i + 1; j <= min(n, i + 2 * d); j++) {         double div = a[j][i] / a[i][i];         for (int k = i; k <= min(n, i + d); k++) a[j][k] -= a[i][k] * div;         a[j][n + 1] -= a[i][n + 1] * div;       }     }     for (int i = n; i >= 1; i--) {       Ans[from[i]] = a[i][n + 1];       for (int j = i + 1; j <= min(i + d, n); j++)         Ans[from[i]] -= Ans[from[j]] * a[i][j];       Ans[from[i]] /= a[i][i];     }   }   int n, m, x, y;   double a[MAXN + 5][MAXN + 5], Ans[MAXN + 5][MAXN + 5];   int main() {     scanf( %d %d %d %d , &n, &m, &x, &y);     if (m == 1) {       printf( %.4f n , 2.0 * (n - x));       return 0;     }     for (int i = n - 1; i >= 1; i--) {       a[1][1] = 2.0 / 3;       a[1][2] = -1.0 / 3;       a[1][m + 1] = 1.0 / 3 * Ans[i + 1][1] + 1;       for (int j = 2; j <= m - 1; j++) {         a[j][j - 1] = -1.0 / 4;         a[j][j] = 3.0 / 4;         a[j][j + 1] = -1.0 / 4;         a[j][m + 1] = 1.0 / 4 * Ans[i + 1][j] + 1;       }       a[m][m - 1] = -1.0 / 3;       a[m][m] = 2.0 / 3;       a[m][m + 1] = 1.0 / 3 * Ans[i + 1][m] + 1;       Gauss(m, 1, a, Ans[i]);     }     printf( %.4f n , Ans[x][y]);     return 0;   }   