cx2013 @ 2024-07-18 21:10:32
#include<bits/stdc++.h>
using namespace std;
int n,num,a[100];
bool lie[100],dui[100],fandui[100];
void d(int t){
if(t==n+1){
if(num<3){
for(int i=0;i<n;++i){
cout<<a[i]<<" ";
}
cout<<endl;
}
num++;
}
for(int i=1;i<=n;++i){
if(int lie[i]==0 && dui[t-i+n]==0 && fandui[t+i]){
a[t]=i;
lie[i]=dui[t-i+n]=fandui[t+i]=1;
d(t+1);
lie[i]=dui[t-i+n]=fandui[t+i]=0;
}
}
}
int main(){
cin>>n;
d(1);
cout<<num;
return 0;
}
by ccxswl @ 2024-07-18 21:13:41
if
里套 int
是啥啊
by Alex110708 @ 2024-07-18 21:16:32
开头的bool改成int再把if里的int削掉就行了
by aygrhnaygrhn @ 2024-07-18 21:25:56
if里不能套int