0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 20:36:28 +00:00

P1002 过河卒

R41202168
This commit is contained in:
Baoshuo Ren 2020-11-04 09:07:50 +08:00 committed by Baoshuo Ren
parent f590742cf9
commit c990d8bb2d
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68
3 changed files with 40 additions and 0 deletions

34
problem/P1002/P1002.cpp Normal file
View File

@ -0,0 +1,34 @@
#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};
int bx, by, mx, my;
long long f[30][30];
bool b[30][30];
int main() {
cin >> bx >> by >> mx >> my;
bx += 2;
by += 2;
mx += 2;
my += 2;
f[2][2] = 1;
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;
}
else {
f[i][j] = max(f[i][j], f[i - 1][j] + f[i][j - 1]);
}
}
}
cout << f[bx][by] << endl;
return 0;
}

BIN
problem/P1002/data/P1002_5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
problem/P1002/data/P1002_5.out (Stored with Git LFS) Normal file

Binary file not shown.