60分代码求助
查看原帖
60分代码求助
1071898
werwere楼主2024/8/26 22:39
#include<bits/stdc++.h>
using namespace std;
int s[25][25];
bool f[25][25];
int dx[10]= {0,-2,-1,1,2,2,1,-1,-2};
int dy[10]= {0,1,2,2,1,-1,-2,-2,-1};
int main() {
//	freopen("XXX.in","r",stdin);
//	freopen("XXX.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int bx,by,hx,hy;
	cin>>bx>>by>>hx>>hy;
	bx+=2,by+=2,hx+=2,hy+=2;
	for(int i=1; i<=8; i++) {
		f[hx+dx[i]][hy+dy[i]]=1;
	}
	f[hx][hy]=1;
	s[2][1]=1;
	for(int i=2; i<=bx; i++) {
		for(int j=2; j<=by; j++) {
			if(!f[i][j]) {
				s[i][j]=s[i-1][j]+s[i][j-1];
			}
		}
	}
	cout<<s[bx][by];
	return 0;
}
2024/8/26 22:39
加载中...