#include <iostream>
using namespace std;
long long map[22][22];
int main() {
int i, x, y, hx, hy, n[9][2] = {{0,0},{1,2},{1,-2},{2,1},{2,-1},{-1,2},{-1,-2},{-2,1},{-2,-1}};//马和可移动的8个位置
long long xcount, ycount;
cin >> x >> y >> hx >> hy;
map[1][1] = 1;
hx++, hy++;
x++, y++;
//标记不可以经过的点
int tmpx,tmpy;
for(i = 0; i < 9; i++) {
tmpx = hx+n[i][0];
tmpy = hy+n[i][1];
if(tmpx>=1&&tmpx<=21 && tmpy>=1&&tmpy<=21) map[tmpx][tmpy] = -1;
}
//开始走
for(i = 1; i <= x; i++) {
for(int j = 1; j <= y; j++) {
if(map[i][j] != -1) {
xcount = map[i-1][j];
ycount = map[i][j-1];
if(xcount > 0) map[i][j] += xcount;
if(ycount > 0) map[i][j] += ycount;
}
}
}
cout << map[x][y] << endl;
return 0;
}
P1002 过河卒
Leave a reply