题目
题目链接
题解DFS。
八皇后问题改编而已,加入判断左上三格内和右上三格内是否存在皇后。
代码#include
using namespace std;
int n, ans;
int col[15], vis[15][15];
bool check (int x, int y) {
int tx = x, ty = y, cnt = 0;
while (tx >= 0 && ty >= 0 && cnt = 0 && ty
关注
打赏