解析 用结构体记录每个空格的位置,把已填过的空格数量作为搜索的深度,处理宫的时候可以打表进行坐标到宫的编号的转换,dfs即可 代码 #include<bits/stdc++.h> using namespace std; struct ty{ int x,y; }space[90]; int mp[12][12]; int h[12][12],l[12][12],gong[12][12]; int cnt=0; const int g[10][10]={{0,0,0,0,0,0,0,0,0,0}, {0,1,1,1,2,2,2,3,...