0分求助
查看原帖
0分求助
908416
zhuletian楼主2023/5/29 19:55

哪个大佬能拯救下本蒟蒻

#include <iostream>
using namespace std;

long long a[25][25];

int main()
{
    a[0][0] = 1;
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= m; j++)
        {
            if (i == 0 && j == 0)  continue;
            if (abs(i - x) == 1 && abs(j - y) == 2 || abs(i - x) == 2 && abs(j - y) == 1 || i == x && j == x)  a[i][j] = 0;
            else  a[i][j] = a[i - 1][j] + a[i][j - 1];
        }
    }
    cout << a[n][m];
    return 0;
}
2023/5/29 19:55
加载中...