60分,求调,样例3、4TLE
查看原帖
60分,求调,样例3、4TLE
1581694
zhizi_楼主2025/1/19 16:53
#include <iostream>
#include <cmath>
using namespace std;
int walk(int x,int y,int a,int b,int m,int n){
	int x1=abs(x-a),x2=abs(y-b);
    if(a==m&&b==n)return 1;
	if(a>m||b>n)return 0;
    if(x1+x2==3&&x1!=3&&x2!=3||x==a&&y==b)
        return 0;
	else return walk(x,y,a+1,b,m,n)+walk(x,y,a,b+1,m,n);
}
int main(){
    int x,y,m,n;
    cin>>m>>n>>x>>y;
    cout<<walk(x,y,0,0,m,n);
	return 0;
}
2025/1/19 16:53
加载中...