60pts 求调
查看原帖
60pts 求调
1320188
wangmingruiakioi楼主2024/3/23 13:37
#include<bits/stdc++.h>
using namespace std;
long long n,m,x,y,ans;
void dfs(int a,int b){
    if(a==n&&b==m){
        ans++;
        return;
    }
    if(!(b+1>m||(a==x&&b+1==y)||(a==x+1||a==x-1)&&(b+1==y-2||b+1==y+2)||(a==x-2||a==x+2)&&(b+1==y-1||b+1==y+1)))dfs(a,b+1);
    if(!(a+1>n||(a+1==x&&b==y)||(a+1==x+1||a+1==x-1)&&(b==y-2||b==y+2)||(a+1==x-2||a+1==x+2)&&(b==y-1||b==y+1)))dfs(a+1,b);
}
int main(){
	//freopen("x.in","r",stdin);
	//freopen("x.out","w",stdout);
    scanf("%lld %lld %lld %lld",&n,&m,&x,&y);
    dfs(0,0);
    printf("%lld",ans);
}
//AC #1、#2、#5 TLE #3、#4
2024/3/23 13:37
加载中...