49. 跳马问题
水题
dfs裸基础
#include<cstdio> using namespace std;
int n,m,mx[]={,,,,},
ans,my[]={,-,,-,};
inline void dfs(int x,int y){
if(x==m&&y==n){ ans++; return;}
for(int i=;i<=;i++){
int tx=mx[i]+x,ty=my[i]+y;
if(tx>&&ty>&&tx<=m&&ty<=n)
dfs(tx,ty);
}
}
int main()
{
freopen("horse.in","r",stdin);
freopen("horse.out","w",stdout);
scanf("%d%d",&n,&m);
dfs(,);
printf("%d",ans);
return ;
}