文件目录

#include <bits/stdc++.h>
using namespace std;
int n, m, x, y;
long long qp[50][50] = {};
int dir[8][2] = {1, 2, -1, 2, 1, -2, -1, -2, 2, 1, -2, 1, 2, -1, -2, -1};
bool isM(int x, int y, int i, int j)
{
    if (x == i && y == j)
        return true;
    for (int k = 0; k < 8; k++)
    {
        int xx = x + dir[k][0];
        int yy = y + dir[k][1];
        if (xx >= 0 && xx <= n && yy >= 0 && yy <= m)
        {
            if (xx == i && yy == j)
                return true;
        }
    }
    return false;
}
int main()
{
    cin >> n >> m >> x >> y;
    // 处理边界
    for (int i = 1; i <= n; i++)
    {
        if (isM(x, y, i, 0))
            break;
        qp[i][0] = 1;
    }
    for (int i = 1; i <= m; i++)
    {
        if (isM(x, y, 0, i))
            break;
        qp[0][i] = 1;
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            if (!isM(x, y, i, j))
            {
                qp[i][j] = qp[i - 1][j] + qp[i][j - 1];
            }
        }
    }
    cout << qp[n][m];
    return 0;
}