40分求助!QAQ
查看原帖
40分求助!QAQ
867681
23_VS_24楼主2023/8/27 11:51
#include<bits/stdc++.h>
using namespace std;
int n,m,x,y;
long long f[22][22]={0};
int ctrl[22][22];
int d[9][2]={{0,0},{2,1},{1,2},{-1,2},{-2,1},{-2,-1},{-1,-2},{1,-2},{2,-1}};
int main()
{
	cin>>n>>m>>x>>y;
	for(int i=0;i<9;i++){
		int tmpx=x+d[i][0],tmpy=y+d[i][1];
		if(tmpx>>=0&&tmpx<=n&&tmpx>=0&&tmpy<=m) ctrl[tmpx][tmpy]=1;
	}
	f[0][0]=1-ctrl[0][0];
	for(int i=0;i<=n;i++){
		for(int j=0;j<=m;j++){
			if(ctrl[i][j]) continue;
			if(i!=0) f[i][j]+=f[i-1][j];
			if(j!=0) f[i][j]+=f[i][j-1];
		}
	}
	cout<<f[n][m];
	
	
	
	
	
	
	
	return 0;
}

2023/8/27 11:51
加载中...