# 代码不知道哪里错了

@云起雾饶 2021-07-07 11:19 回复

#include <iostream>

using namespace std;

bool flag[101][101] = {false};
int a[101][101];
int bx,by;
int ma,mb;

int main () {
cin >> by >> bx;
cin >> ma >> mb;

for (int i = 0; i < by; i++) {
a[i][0] = 1;
}
for (int i = 0; i < bx; i++) {
a[0][i] = 1;
}
flag[ma - 1][mb - 2] = true;;
flag[ma - 1][mb + 2] = true;
flag[ma + 1][mb - 2] = true;
flag[ma + 1][mb + 2] = true;
flag[ma - 2][mb - 1] = true;
flag[ma - 2][mb + 1] = true;
flag[ma + 2][mb - 1] = true;
flag[ma + 2][mb + 1] = true;

for (int i = 1; i < by + 1; i++) {
for (int j = 1; j < bx + 1; j++) {
if (flag[i][j] != true) {
a[i][j] = a[i][j - 1] + a[i - 1][j];
}
else {
a[i][j] = 0;
}
}
}
cout << a[by][bx];

return 0;
}
@云起雾饶 2021-07-07 12:02 回复 举报

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

long long flag[1001][1001];
long long a[1001][1001];
long long bx,by;
long long ma,mb;

int main () {
cin >> by >> bx;
cin >> ma >> mb;

for (int i = 0; i <= by; i++) {
a[i][0] = 1;
}

for (int i = 0; i <= bx; i++) {
a[0][i] = 1;
}

flag[ma][mb] = 1;
flag[ma - 1][mb - 2] = 1;
flag[ma - 1][mb + 2] = 1;
flag[ma + 1][mb - 2] = 1;
flag[ma + 1][mb + 2] = 1;
flag[ma - 2][mb - 1] = 1;
flag[ma - 2][mb + 1] = 1;
flag[ma + 2][mb - 1] = 1;
flag[ma + 2][mb + 1] = 1;

for (int i = 1; i <= by ; i++) {
for (int j = 1; j <= bx; j++) {
if (flag[i][j] != 1) {
a[i][j] = a[i][j - 1] + a[i - 1][j];
}
else {
a[i][j] = 0;
}
}
}
cout << a[by][bx];

return 0;
}