#include <bits/stdc++.h>
using namespace std;
int cnt,n;
int a[100];
bool h[100];
bool l[100];
bool lx[200];
bool ly[200];
void dfs(int t){
if(t==n+1){
cnt++;
if(cnt<=3){
for(int i=1;i<=n;i++)
cout<<a[i]<<" ";
cout<<endl;
}
return ;
}
for(int i=1;i<=n;i++) {
if( !h[t] && !l[i] && !lx[t-i+10] && !ly[t+i] ){
a[t]=i;
h[t]=true;
l[i]=true;
lx[t-i+10]=true;
ly[t+i]=true;
dfs(t+1) ;
h[t]=false;
l[i]=false;
lx[t-i+10]=false;
ly[t+i]=false;
}
}
}
int main(){
dfs(1);
cin>>n;
cout<<cnt;
return 0;
}
哪里错了,帮帮我