标签:void log _for == printf mes return big color
/*Hatsune Miku 4ever!*/ #include <bits/stdc++.h> using namespace std; typedef long long ll; #define _for(i,a,b) for(int i = (a);i < b;i ++) #define _rep(i,a,b) for(int i = (a);i > b;i --) #define INF 0x3f3f3f3f3f3f3f3f #define lowbit(x) ((x)&(-x)) #define pb push_back #define MIKU 39 #define Design ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define debug() printf("Miku Check OK!\n") #define bigmiku 3939393939 #define LOG 18 #define maxn 20 #define maxe 200039 int mp[maxn][maxn]; int vis[3][maxn*maxn]; int cnt = 1; void dfs(int cur, int n) { if(cur==n+1) { printf("第 %d 种:\n",cnt); _for(i,1,n+1) { _for(j,1,n+1) printf("%c ",mp[i][j]); printf("\n"); } printf("\n"); cnt ++; return ; } _for(i,1,n+1) if(!vis[0][i]&&!vis[1][cur+i]&&!vis[2][cur-i+n]) { mp[cur][i] = ‘Q‘; vis[0][i] = vis[1][cur+i] = vis[2][cur-i+n] = 1; dfs(cur+1,n); mp[cur][i] = ‘.‘; vis[0][i] = vis[1][cur+i] = vis[2][cur-i+n] = 0; } } int main() { _for(i,0,maxn) _for(j,0,maxn) mp[i][j] = ‘.‘; int n; scanf("%d",&n); dfs(1,n); printf("%d 皇后一共有 %d 种\n",n,cnt-1); return 0; }
标签:void log _for == printf mes return big color
原文地址:https://www.cnblogs.com/Asurudo/p/14153606.html