这道题啊 。 。不说啥了 ~数据量很小,暴力深搜,不需要啥剪枝就能过。
代码如下:
#include <iostream>using namespace std;const int xp[8]={-2,-2,-1,-1,1,1,2,2};const int yp[8]={-1,1,-2,2,-2,2,-1,1};struct node{ int px,py; };int n,p,q,tot,t=0;node d[27];bool flag,map[26][26];void dfs(int x,int y,int sum){ int tx,ty,i,k; map[x][y]=true; d[sum].px=x; d[sum].py=y; if(sum==p*q) { flag=true; cout<<"Scenario #"<<t<<":"<<endl; for(k=1;k<=tot;k++......
阅读全文