过河卒 求助
查看原帖
过河卒 求助
176316
HamburgerFav楼主2020/10/1 13:04

为什么全 WA

#include "bits/stdc++.h"
#define MAXN 25
using namespace std;

unsigned long long int dp[MAXN][MAXN] = { 1 };
bool ifHorse[MAXN][MAXN] = { true };
int hMovX[8] = { -2, -1, 1, 2, -2, -1, 1, 2 };
int hMovY[8] = { 1, 2, 2, 1, -1, -2, -2, -1 };
int hPosX, hPosY;
int sDesX, sDesY;

int main()
{
	scanf("%d%d%d%d", &sDesX, &sDesY, &hPosX, &hPosY);

	for (int i = 0; i < 8; i++)
	{
		for (int j = 0; j < 8; j++)
		{
			ifHorse[hPosX + hMovX[i]][hPosY + hMovY[j]] = false;
		}
	}

	for (int i = 0; i < sDesX; i++)
	{
		for (int j = 0; j < sDesY; j++)
		{
			if (ifHorse[i][j]) {
				dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j];
			}	
		}
	}

	printf("%d", dp[sDesX][sDesY]);

	return 0;
}
2020/10/1 13:04
加载中...