#3#4WA 60pts
查看原帖
#3#4WA 60pts
524091
dami826楼主2023/7/13 15:11
#include<bits/stdc++.h>
using namespace std;
bool ctrl[21][21];
long long s[21][21];
int h1[9]={0,1,2,-1,-2,1,2,-1,-2};
int h2[9]={0,2,1,-2,-1,-2,-1,2,1};
int main(){ 
	long long n,m,a,b;
	scanf("%lld %lld %lld %lld",&n,&m,&a,&b);
	s[0][0]=1;
	for(int i=0;i<=8;i++){
		ctrl[a+h1[i]][b+h2[i]]=true;
	} 
	for(int i=0;i<=n;i++){
		for(int j=0;j<=m;j++){
			if(i==0&&j==0){
				continue;
			}
			if(ctrl[i][j]==false){
				if(i==0){
					s[i][j]=s[i][j-1];
				}
				else{
					if(j==0){
						s[i][j]=s[i-1][j];
					}
					else{
						s[i][j]=s[i-1][j]+s[i][j-1];
					}
				}
			}
		}
	}
	printf("%lld",s[n][m]);
    return 0;
}
2023/7/13 15:11
加载中...