我哪里错了
查看原帖
我哪里错了
1544489
aa123456abcdef楼主2024/11/22 23:11
#include<bits/stdc++.h>
using namespace std;
int f[22][22];
bool s[22][22];
const int fx[]={-2,-1,1,2,2,1,-1,-2};
const int fy[]={1,2,2,1,-1,-2,-2,-1};
int main(){
    int bx,by,mx,my;
    cin>>bx>>by>>mx>>my;
    bx+=2;by+=2;mx+=2;my+=2;
    f[2][1]=1;
    s[mx][my]=1;
    for(int i=0,i<=8;i++)s[mx+fx[i]][my+fy[i]]=1;
    for(int j=2;j<=bx;j++){
        for(int m=2;m<=by;m++){
            if(s[j][m])coutinue;
            f[j][m]=f[j-1][m]+f[j][m-1];
            }
        }
    cout<<f[bx][by];
    return 0;
}
2024/11/22 23:11
加载中...