10分求助
查看原帖
10分求助
1015482
huzixiao楼主2024/12/5 17:38
#include<iostream>
using namespace std;
typedef long long ll;
int ex, ey, hx, hy;
ll dp[25][25];
bool h[25][25];
void start() {
	dp[1][2] = 1;
	dp[2][1] = 1;
	h[hx][hy] = true;
	h[(hx >= 2 ? hx - 2 : 0)][(hy >= 1 ? hy - 1 : 0)] = true;
	h[(hx >= 2 ? hx - 2 : 0)][hy + 1] = true;
	h[(hx >= 1 ? hx - 1 : 0)][(hy >= 2 ? hy - 2 : 0)] = true;
	h[(hx >= 1 ? hx - 1 : 0)][hy + 2] = true;
	h[hx + 1][(hy >= 2 ? hy - 2 : 0)] = true;
	h[hx + 1][hy + 2] = true;
	h[hx + 2][(hy >= 1 ? hy - 1 : 0)] = true;
	h[hx + 2][hy + 1] = true;
}
int main() {
	cin >> ex >> ey >> hx >> hy;
	start();
	for (int i = 1; i <= ex; i++) {
		for (int j = 1; j <= ey; j++) {
			if (h[i][j] || dp[i][j]) {
				continue;
			}
			dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
		}
	}
	cout << dp[ex][ey];
	return 0;
}
2024/12/5 17:38
加载中...