ce
查看原帖
ce
1246271
sshhgggddsbf楼主2024/7/3 11:17
#include<bits/stdc++.h>
using namesace std;
long long a[1000][1000];
int main (){
long long b,c,x,y;
cin>>b>>c>>x>>y;
for(long long i=0;i<=b;i++){
	for(long long j=0;j<=c;j++){
		a[i][j]=1;
	}
}
a[x][y]=0;
if(x-1>=0 && y-2>=0) a[x-1][y-2]=0;
if(x-2>=0 && y-1>=0) a[x-2][y-1]=0;
if(x-2>=0 && y+1<=c) a[x-2][y+1]=0;
if(x-1>=0 && y+2<=c) a[x-1][y+2]=0;
if(x+1<=b && y-2>=0) a[x+1][y-2]=0;
if(x+2<=b && y-1>=0) a[x+2][y-1]=0;
if(x+1<=b && y+2<=c) a[x+1][y+2]=0;
if(x+2<=b && y+1<=c) a[x+2][y+1]=0;
for(long long i=0;i<=b;i++){
	for(long long j=0;j<=c;j++){
		if(i==0 && j==0)continue;
		if(a[i][j]==0)continue;
		else if(i==0 && j>0)a[i][j]=a[i][j-1];
		else if(j==0 && i>0)a[i][j]=a[i-1][j];
		else{
			a[i][j]=a[i-1][j]+a[i][j-1];
		}
	}
}

cout<<a[b][c]<<endl;
return 0;
}

2024/7/3 11:17
加载中...