0分,请教各位大佬
查看原帖
0分,请教各位大佬
1498750
jiangzisheng楼主2025/6/20 10:31
#include <iostream>
using namespace std;
int hx,hy,ex,ey;
int h[9][2]={{1,2},{-1,2},{1,-2},{-1,-2},{2,-1},{2,1},{-2,1},{-2,-1} , {0,0}};
long long ans(int x,int y) {
    if(x>=4||y>=8)return 0;
    if(x==ex&&y==ey)return 1;
    bool flag=false;
    for(int i=0;i<9;i++) {
        if(x==hx+h[i][0]&&y==hy+h[i][1])flag=true;
    }
    if(flag==true)
        return 0;
    return ans(x+1,y)+ans(x,y+1);
}
int main() {

    scanf("%d %d %d %d",&hx,&hy,&ex,&ey);
    hx--,hy--,ex--,ey--;
    printf("%lld",ans(0,0));
    return 0;
}
2025/6/20 10:31
加载中...