蒙自市凤凰小学又阝十尃亻二 • 1年前
//为什么要5个场宽啊(恼
using namespace std; int n, colcnt, x; int ______;
void dfs(int row) {
if (________) {
for (int i = 1; i <= n; i++)
printf("___",a[i]);
cout << endl;
colcnt++;
return;
}
for (int col = 1; col <= n; col++) {
if (a1[col]) //当前列已经被占用
_______
if (a3[10 + row - col]) //主对角线被占用
_______
if (a2[row + col]) //副对角线被占用
_______
a[row] = col;
a1[col] = 1;
a2[row + col] = 1;
a3[10 + row - col] = 1;
dfs(row + 1);
a1[col] = 0;
a2[row + col] = 0;
a3[10 + row - col] = 0;
}
}
int main() {
cin >> n;
dfs(1);
if (_______)
cout << "no solute!";
return 0;
}
评论:
请先登录,才能进行评论