#include <iostream>
using namespace std;
long long map[24][24];
int main()
{
int n, m, a, b;
cin >> n >> m >> a >> b;
map[a][b] = -1;
if (a - 2 >= 0 && b - 1 >= 0)
map[a - 2][b - 1] = -1;
if (a - 1 >= 0 && b - 2 >= 0)
map[a - 1][b - 2] = -1;
if (a + 1 <= n && b - 2 >= 0)
map[a + 1][b - 2] = -1;
if (a + 2 <= n && b - 1 >= 0)
map[a + 2][b - 1] = -1;
if (a - 2 >= 0 && b + 1 <= m)
map[a - 2][b + 1] = -1;
if (a - 1 >= 0 && b + 2 <= m)
map[a - 1][b + 2] = -1;
if (a + 2 <= n && b + 1 <= m)
map[a + 2][b + 1] = -1;
if (a + 1 <= n && b + 2 <= m)
map[a + 1][b + 2] = -1;
map[0][0] = 1;
for (int i = 0; i <= n; i++)
{
for (int j = 0; j <= m; j++)
{
if (map[i][j] != -1)
{
if (map[i - 1][j] != -1 && i != 0) map[i][j] += map[i - 1][j];
if (map[i][j - 1] != -1 && j != 0) map[i][j] += map[i][j - 1];
}
}
}
cout << map[n][m] << endl;
return 0;
}
洛谷P1002 过河卒
最新推荐文章于 2024-02-03 16:01:12 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)