#include <bits/stdc++.h>
using namespace std;
int end_x,end_y,h_x,h_y,num;
bool vis[21][21];
const int dx[2]={0,1};
const int dy[2]={1,0};
void vis_init(){
vis[h_x-1][h_y-1]=true;
if(h_x+1<=end_x && h_y<=end_y){
vis[h_x+1][h_y]=true;
}
if(h_x<=end_x && h_y+1<=end_y){
vis[h_x][h_y+1]=true;
}
if(h_x-2<=end_x && h_y+1<=end_y){
vis[h_x-2][h_y+1]=true;
}
if(h_x-3<=end_x && h_y<=end_y){
vis[h_x-3][h_y]=true;
}
if(h_x-3<=end_x && h_y-2<=end_y){
vis[h_x-3][h_y-2]=true;
}
if(h_x-2<=end_x && h_y-3<=end_y){
vis[h_x-2][h_y-3]=true;
}
if(h_x<=end_x && h_y-3<=end_y){
vis[h_x][h_y-3]=true;
}
if(h_x+1<=end_x && h_y-2<=end_y){
vis[h_x+1][h_y-2]=true;
}
}
int dfs(int x,int y){
if(x == end_x-1 && y == end_y-1){
++num;//路径数加1
return 0;
}
for(int i=0;i<2;++i){
int try_x=x+dx[i];
int try_y=y+dy[i];
if(!vis[try_x][try_y] && try_x < end_x && try_y < end_y && try_x >= 0 && try_y >= 0){
//能让cur进入下一个合法状态
vis[try_x][try_y]=true;
dfs(try_x,try_y);
vis[try_x][try_y]=false;
}
}
return 0;
}
int main(){
scanf("%d %d %d %d",&end_x,&end_y,&h_x,&h_y);
cout<<h_y<<endl;
//把走不了的标记
vis_init();
vis[0][0]=true;
dfs(0,0);
vis[0][0]=false;
printf("%d",num);
return 0;
}
我不觉得有什么问题啊?为什么过不了呢?