0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-24 08:48:49 +00:00
OI-codes/Luogu/P1002/P1002.cpp

34 lines
720 B
C++
Raw Normal View History

2020-11-04 01:07:50 +00:00
#include <bits/stdc++.h>
using namespace std;
const int fx[] = {0, -2, -1, 1, 2, 2, 1, -1, -2};
const int fy[] = {0, 1, 2, 2, 1, -1, -2, -2, -1};
2021-11-19 09:01:13 +00:00
int bx, by, mx, my;
2020-11-04 01:07:50 +00:00
long long f[30][30];
2021-11-19 09:01:13 +00:00
bool b[30][30];
2020-11-04 01:07:50 +00:00
int main() {
cin >> bx >> by >> mx >> my;
bx += 2;
by += 2;
mx += 2;
my += 2;
2021-11-19 09:01:13 +00:00
f[2][2] = 1;
2020-11-04 01:07:50 +00:00
b[mx][my] = true;
for (int i = 1; i <= 8; i++) {
b[mx + fx[i]][my + fy[i]] = true;
}
for (int i = 2; i <= bx; i++) {
for (int j = 2; j <= by; j++) {
if (b[i][j]) {
continue;
2021-11-19 09:01:13 +00:00
} else {
2020-11-04 01:07:50 +00:00
f[i][j] = max(f[i][j], f[i - 1][j] + f[i][j - 1]);
}
}
}
cout << f[bx][by] << endl;
return 0;
}