@[yuyjcode](/user/1126325) 显然,unsigned long long 无负数
by Manchester_Is_Blue @ 2024-01-23 12:25:00
```
#include<bits/stdc++.h>
using namespace std;
const int maxn = 25;
const int dx[8] = {2, 1, -1, -2, -2, -1, 1 ,2};
const int dy[8] = {1, 2, 2, 1, -1, -2, -2 ,-1};
int zhangaiwu[maxn][maxn];
long long dp[maxn][maxn];
int main(){
int bx,by, mx, my;
while(cin>>bx>>by>>mx>>my){
memset(zhangaiwu, 0, sizeof(zhangaiwu));
zhangaiwu[mx][my] = 1;
for(int i=0; i<=7; i++)
if(mx+dx[i]>=0 && mx+dx[i]<=bx && my+dy[i]>=0 && my+dy[i]<=by)
zhangaiwu[mx+dx[i]][my+dy[i]] = 1;
int row=0;
while(zhangaiwu[row][0]==0 && row<=bx)
dp[row++][0] = 1;
int col=0;
while(zhangaiwu[0][col]==0 && col<=by)
dp[0][col++] = 1;
for(int i=1; i<=bx; i++){
for(int j=1; j<=by; j++){
if(zhangaiwu[i][j]) dp[i][j]=0;
else dp[i][j] = dp[i-1][j] + dp[i][j-1];
}
}
cout<<dp[bx][by]<<endl;
}
return 0;
}
```
by Fishen @ 2024-01-23 12:25:48
@[yuyjcode](/user/1126325) 你代码第 7 行的 op 数组是 unsigned long long,但是数组元素有负数。
by Manchester_Is_Blue @ 2024-01-23 12:27:27
@[yuyjcode](/user/1126325) 请不要滥用unsigned long long
by Special_Tony @ 2024-01-23 12:39:11
@[_ SOVIET_](https://www.luogu.com.cn/user/556851) 谢谢,已关注
by I_like_play_eggy @ 2024-01-23 13:17:37
其他两位也已关注
by I_like_play_eggy @ 2024-01-23 13:18:35
AC
```c
#include<iostream>
using namespace std;
const int N = 35;
int n, m, x, y;
long long dp[N][N];
bool vis[N][N];
int X[8] = {-2, -1, 1, 2, 2, 1, -1, -2};
int Y[8] = {-1, -2, -2, -1, 1, 2, 2, 1};
int main()
{
cin >> n >> m >> x >> y;
dp[2][1] = 1;
vis[x+2][y+2] = 1;
for (int i = 0; i < 8; i ++)
vis[x+X[i]+2][y+Y[i]+2] = 1;
for (int i = 2; i <= n+2; i ++)
for (int j = 2; j <= m+2; j ++) {
if (vis[i][j])
continue;
dp[i][j] = dp[i-1][j] + dp[i][j-1];
}
cout << dp[n+2][m+2];
return 0;
}
```
by timmyliao @ 2024-01-23 13:19:42