40分题解
查看原帖
40分题解
983593
lihaoran2012楼主2023/10/22 15:41
#include<bits/stdc++.h>
using namespace std;
int mu[100][100]={};
int MX[]={0,-1,-2,-2,-1,1,2, 2, 1};
int MY[]={0,-2,-1, 1, 2,2,1,-1,-2};
int plan(int x,int y){
	if(x==0||y==0){
		return 1;
	}
	if(mu[x][y]==1){
		return 0;
	}
	return plan(x-1,y)+plan(x,y-1);
}
int main(){
int x,y,xm,ym;
cin>>x>>y>>xm>>ym;
for(int i=0;i<9;i++){
	int posx=xm+MX[i];
	int posy=ym+MY[i];
	if(posx>=0&&posx<=x&&posy>=0&&posy<=y){
		mu[posx][posy]=1;
	}
}
cout<<plan(x,y);
return 0;
}

2023/10/22 15:41
加载中...