![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> using namespace std; bool vis[20][20]; int dx[]={0,0,-1,1}; int dy[]={1,-1,0,0}; int ans; void dfs(int x,int y,int k) { for(int i=0;i<4;i++) { int fx=x+dx[i]; int fy=y+dy[i]; if(fx>=1&&fx<=5&&fy>=1&&fy<=3&&!vis[fx][fy]) { if(fx==1&&fy==3&&k==1) { ans++; continue; } else if(fx==1&&fy==3) { continue; } else { vis[fx][fy]=true; dfs(fx,fy,k-1); vis[fx][fy]=false; } } } } int main() { ans=0; memset(vis,false,sizeof(vis)); vis[1][1]=true; dfs(1,1,14); printf("%d\n",ans); return 0; }