题目
样例没过,死活找不出错
代码:
#include<bits/stdc++.h>
using namespace std;
int n,m,t,fx[4][2]={{1,2},{-1,2},{2,1},{-2,1}},cnt=0;
bool b[20][20];
void dfs(int x,int y){
if(x==n&&y==m){
cnt++;
return;
}
else{
for(int i=0;i<4;i++){
int nx=x+fx[i][0];
int ny=y+fx[i][1];
if(nx>=1&&ny>=1&&nx<=n&&ny<=m&&b[nx][ny]==false){
b[nx][ny]=true;
dfs(nx,ny);
b[nx][ny]=false;
}
}
}
return;
}
int main(){
scanf("%d%d",&n,&m);
b[1][1]=true;
dfs(1,1);
printf("%d",cnt);
return 0;
}