测试数据过了但 2RE 3WA(呜呜呜)
查看原帖
测试数据过了但 2RE 3WA(呜呜呜)
829643
devcjj楼主2023/2/4 10:10

cpp

#include<iostream>
#include<cmath>
using namespace std;
long long a[30][30] = { 0 };
int  f(int i,int j,int n, int m)
{
	if (i > n)return 0;
	if (j > m)return 0;
	if (a[i][j] > 0)
	{
		return a[i][j];
	}
	if (a[i][j] == -1)
	{
		return 0;
	}
	a[i][j] += f(i + 1, j, n, m) + f(i, j + 1, n, m);
	
}
int main()
{
	int n, m, x, y;
	cin >> n >> m >> x >> y;
	a[n][m]=1;
	int dx[] = { -2,-2,-1,1,2,2,1,-1 };
	int dy[] = { -1,1,2,2,1,-1,-2,-2 };
	for (int i = 0; i < 8; i++)
	{
		a[x + dx[i]][y + dy[i]] = -1;
	}
	a[x][y] = -1;
	f(0,0,n, m);
	cout << a[0][0] ;
}
2023/2/4 10:10
加载中...