aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#include<iostream>
using namespace std;
int m,n,ci,cj;
const int hx[8]={-2,-2,-1,-1,1,1,2,2};
const int hy[8]={-1,1,2,-2,-2,2,-1,1};//马走的 
long long a[114][114];
bool check(int x,int y){
	for(int i=0;i<8;i++){//判断控制点 
    	int nx=ci+hx[i];
    	int ny=cj+hy[i];
    	if(x==nx&&y==ny) return 0;
	}
	if(x==ci&&y==cj) return 0;//判断和马重合 
	return 1;
}
void array_print(){//输出数组 
	for(int i=0;i<=n;i++){
		for(int j=0;j<=m;j++){
			cout<<a[i][j]<<' ';
		} 
		cout<<endl;
	}
	cout<<endl;
}
int main(){
	cin>>n>>m>>ci>>cj; 
//	array_print();
	for(int i=0;i<=n;i++) if(check(i,0)) a[i][0]=1;//边缘全是1 
	for(int i=0;i<=m;i++) if(check(0,i)) a[0][i]=1;
//	array_print();
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			a[i][j]=a[i-1][j]+a[i][j-1];//上下之和 
			if(!check(i,j)) a[i][j]=0;//是控制点就0 
//			array_print();
		}
	}
	cout<<a[n][m];
	return 0;
}
//5 6 2 3 

1 comments

  • 1

Information

ID
799
Time
1000ms
Memory
256MiB
Difficulty
5
Tags
# Submissions
95
Accepted
34
Uploaded By