-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
30 lines (22 loc) · 762 Bytes
/
main.cpp
File metadata and controls
30 lines (22 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <bits/stdc++.h>
using namespace std;
int main() {
int bx, by, mx, my;
cin >> bx >> by >> mx >> my;
vector<int> mlx = {0, -1, 1,2, -2, -2, -1, 2, 1};
vector<int> mly = {0, 2, 2, 1, 1, -1, -2, -1, -2};
vector<vector<long long>> dp(30, vector<long long>(30, 0));
vector<vector<bool>> checker(30, vector<bool>(30, false));
bx += 2; by += 2; mx += 2; my += 2;
for (int i = 1; i <= 8; i ++)
checker[mx + mlx[i]][my + mly[i]] = true;
checker[mx][my] = true;
dp[2][1] = 1;
for (int i = 2; i <= bx; i ++) {
for (int j = 2; j <= by; j ++) {
if (checker[i][j]) continue;
dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
}
}
cout << dp[bx][by] << endl;
}