#include<bits/stdc++.h>
using namespace std;
int v[15][15];
int ans[15];
int dx[8]={0,1,1,1,0,-1,-1,-1};
int dy[8]={1,1,0,-1,-1,-1,0,1};
int n,tot;
bool cheak(int x,int y){
return (x>=1&&x<=n&&y>=1&&y<=n);
}
void m_set(int x,int y){
int tx,ty;
v[x][y]++;
int i;
for (i=0;i<8;i++){
tx=x+dx[i];
ty=y+dy[i];
while (cheak(tx,ty)){
v[tx][ty]++;
}
}
}
void m_erz(int x,int y){
int tx,ty;
v[x][y]--;
int i;
for (i=0;i<8;i++){
tx=x+dx[i];
ty=y+dy[i];
while (cheak(tx,ty)){
v[tx][ty]--;
}
}
}
void write(){
int i;
tot++;
if (tot<=3){
for (i=1;i<=n;i++){
cout<<ans[i]<<' ';
}
puts("");
}
}
void dg(int d){
int i;
if (d==n){
white();//'white' was not declared in this scope
return;
}
for (i=1;i<=8;i++){
if (!v[i][d]){
ans[i]=d;
m_set(i,d);
dg(d+1);
m_erz(i,d);
ans[i]=0;
}
}
}
int main(){
cin>>n;
dg(1);
}
加注释的那行CE了,哪位大佬看看是为什么