求助
查看原帖
求助
1385029
ziqikang楼主2024/12/21 20:14
#include<bits/stdc++.h>
using namespace std;

int sum = 0;

int mp[100][100];
int a,b,c,d;
int chess(int x,int y) {
	if (mp[x][y] == 2) return 1;
	if (mp[x+1][y] != 1 && x + 1 <= a) sum = sum + chess(x+1,y);
	if (mp[x][y+1] != 1 && y + 1 <= b) sum = sum + chess(x,y+1);
	return sum;
}

int main()
{
	cin >> a >> b >> c >> d;
	mp[a][b] = 2;
	mp[c][d] = 1;
	mp[c+2][d+1] = 1;
	mp[c+1][d+2] = 1;
	mp[c-1][d+2] = 1;
	mp[c-2][d+1] = 1;
	mp[c-2][d-1] = 1;
	mp[c-1][d-2] = 1;
	mp[c+1][d-2] = 1;
	mp[c+2][d-1] = 1;
	cout << chess(0,0);
	return 0;
}
2024/12/21 20:14
加载中...