#include<bits/stdc++.h>
using namespace std;
struct node{
int x,y;
}horse,goal;
int main(){
long long a[25][25];
cin>>goal.x>>goal.y>>horse.x>>horse.y;
for(int i=0;i<=goal.x;i++)
for(int j=0;j<=goal.y;j++) a[i][j]=1;
if(horse.x>=0 && horse.x<=goal.x && horse.x-2>=0 && horse.x-2<=goal.x && horse.x-1>=0&&horse.x-1<=goal.x && horse.x+2>=0&&horse.x+2<=goal.x && horse.x+1>=0&&horse.x+1<=goal.x)
if(horse.y>=0 && horse.y<=goal.y && horse.y-1>=0&&horse.y-1<=goal.y && horse.y-2>=0&&horse.y-2<=goal.y && horse.y+1>=0&&horse.y+1<=goal.y && horse.y+2>=0&&horse.y+2<=goal.y){
a[horse.x][horse.y]=0;
a[horse.x-2][horse.y-1]=0;
a[horse.x-2][horse.y+1]=0;
a[horse.x+1][horse.y+2]=0;
a[horse.x-1][horse.y+2]=0;
a[horse.x+2][horse.y+1]=0;
a[horse.x+2][horse.y-1]=0;
a[horse.x-1][horse.y-2]=0;
a[horse.x+1][horse.y-2]=0;
}
for(int i=1;i<=goal.x;i++) {
if(a[i][0]==0) continue;
a[i][0]=a[i-1][0];
}
for(int i=1;i<=goal.y;i++){
if(a[0][i]==0) continue;
a[0][i]==a[0][i-1];
}
for(int i=1;i<=goal.x;i++)
for(int j=1;j<=goal.y;j++){
if(a[i][j]==0) continue;
a[i][j]=a[i-1][j]+a[i][j-1];
}
for(int i=0;i<=goal.x;i++){
for(int j=0;j<=goal.y;j++)
cout<<a[i][j]<<" ";
printf("\n");
}
if(a[0][0]==0 || (a[0][1]==0&&a[1][0]==0)) cout<<"0";
else cout<<a[goal.x][goal.y];
return 0;
}
有两个测试点出错了,
头秃!!