delete pics to save space

This commit is contained in:
2023-08-03 09:22:52 +08:00
commit de60cd6ed4
1334 changed files with 66221 additions and 0 deletions

View File

@ -0,0 +1,37 @@
#include<cstdio>
#include<cmath>
int x[26];
int ans=-1;
int chuan[92];
bool check(int y)
{
for(int i=1;i<y;i++)
if(x[i]==x[y]||abs(i-y)==abs(x[i]-x[y])) return 0;
return 1;
}
void print(int n)
{
chuan[ans]=x[0];
for(int i=1;i<=8;i++) chuan[ans]=chuan[ans]*10+x[i];
}
void dfs(int y,int n)
{
if(y>n){ans++;print(n);return;}
for(int i=1;i<=n;i++)
{
x[y]=i;
if(check(y)) dfs(y+1,n);
}
}
int main()
{
int n;
n=8;
dfs(1,n);
scanf("%d",&n);
int sr[n];
for(int i=0;i<n;i++) scanf("%d",sr+i);
for(int i=0;i<n;i++) printf("%d\n",chuan[sr[i]-1]);
return 0;
}