#3 #4 WA 求调
查看原帖
#3 #4 WA 求调
1081117
jinhao_wang楼主2025/7/24 14:45
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long v[22][22] = {};
	long long x, y;
	long long horse_x, horse_y;
	cin >> x >> y >> horse_x >> horse_y;
	for (long long i = 0; i < 20; i++) {
		for (long long j = 0; j < 20; j++) {
			if (
				(i == horse_x + 0 && j == horse_y + 0) ||
				(i == horse_x + 2 && j == horse_y + 1) ||
				(i == horse_x + 2 && j == horse_y - 1) ||
				(i == horse_x - 2 && j == horse_y + 1) ||
				(i == horse_x - 2 && j == horse_y - 1) ||
				(i == horse_x + 1 && j == horse_y + 2) ||
				(i == horse_x + 1 && j == horse_y - 2) ||
				(i == horse_x - 1 && j == horse_y + 2) ||
				(i == horse_x - 1 && j == horse_y - 2)
			){
				v[i][j] = 0;
			}
			else if (i == 0 || j == 0) {
				v[i][j] = 1;
			}
			else {
				v[i][j] = v[i - 1][j] + v[i][j - 1];
			}
		}
	}
	cout << v[x][y]<<endl;
	return 0;
}
2025/7/24 14:45
加载中...