poj2488
#include#include #include #include #include #define Max 30 using namespace std; int n,m; int temp; int vis[Max][Max]; int dir[8][2]={{-1,-2},{1,-2},{-2,-1},{2,-1},{-2,1},{2,1},{-1,2},{1,2}}; int dfs(int x,int y,int step,string tt) { if(step==temp) { cout<=0 && xx =0 && yy >t; int ans=1; while(t--) { scanf("%d%d",&n,&m); temp=n*m; memset(vis,0,sizeof(vis)); vis[0][0]=1; printf("Scenario #%d:\n",ans++); if(!dfs(0,0,1,"A1")) printf("impossible\n\n"); } return 0; }