点3和点4 WA了,请大佬求救
查看原帖
点3和点4 WA了,请大佬求救
779486
spacetar楼主2023/2/3 21:10

点3:

Wrong Answer.wrong answer On line 1 column 6, read 1, expected 3。

点4:

Wrong Answer.wrong answer On line 1 column 9, read 2, expected 3.

其中点3取过测试数据,但结果却是对的

#include <iostream>
using namespace std;
long long dp[21][21];
bool a[21][21];
int d[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}};
int main(){
	int x,y,n,m;
	cin >> x >> y >> n >> m;
	for(int i = 0;i<=7;i++){
		a[n+d[i][0]][m+d[i][1]] = 1;
	}
	a[n][m] = 1;
	for(int i =0;i<=x;i++){
		for(int j = 0;j<=y;j++){
			if(a[i][j] == 0){
				if(i==0&&j==0){
					dp[i][j] = 1;
				}
				if(i>0){
					dp[i][j]+= dp[i-1][j];
				}
				if(j>0){
					dp[i][j]+= dp[i][j-1];
				}
			}
		}
	}
	cout << dp[x][y];
	return 0;
} 

恳请各位大佬帮忙,感谢

2023/2/3 21:10
加载中...