为什么只有 60 分啊 QAQ,求大佬帮帮?
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int horse[8][2] = {{-2, 1}, {-1, 2}, {1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1}};
const int N = 25;
int n, m, hx, hy;
ll f[N][N];
bool vis[N][N];
int main(){
scanf("%d%d%d%d",&n,&m,&hx,&hy);
vis[hx][hy] = 1;
for(int i = 0; i < 8; i++){
int tx = hx + horse[i][0], ty = hy + horse[i][1];
if(tx < 0 || tx > n || ty < 0 || ty > m) continue;
vis[tx][ty] = 1;
}
for(int i = 0; i <= m; i++) if(!vis[0][i]) f[0][i] = 1;
for(int i = 0; i <= n; i++) if(!vis[i][0]) f[i][0] = 1;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
if(vis[i][j]) continue;
f[i][j] = f[i - 1][j] + f[i][j - 1];
}
}
printf("%lld\n",f[n][m]);
return 0;
}