From f49c6c79387b16902a9a5632c4981e2159de29c6 Mon Sep 17 00:00:00 2001 From: xkm Date: Thu, 11 Jun 2026 19:11:25 +0800 Subject: [PATCH] 3-B-1 --- 3-B-1/README.md | 5 +++++ 3-B-1/main.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 3-B-1/README.md create mode 100644 3-B-1/main.cpp diff --git a/3-B-1/README.md b/3-B-1/README.md new file mode 100644 index 0000000..ea9e5ac --- /dev/null +++ b/3-B-1/README.md @@ -0,0 +1,5 @@ +# 八皇后 + +[P1219](https://www.luogu.com.cn/problem/P1219) + +[code](https://www.luogu.com.cn/record/138423182) diff --git a/3-B-1/main.cpp b/3-B-1/main.cpp new file mode 100644 index 0000000..4af2381 --- /dev/null +++ b/3-B-1/main.cpp @@ -0,0 +1,43 @@ +#include + +using namespace std; + +int xie[26], nxie[26]; +int wei[13], h[13]; +int sum; + +void dfs(int d, int n) +{ + if (d == n) + { + sum++; + if (sum <= 3) + { + for (int i = 0; i < n; i++) + { + cout << wei[i]+1 << ' '; + } + cout << endl; + } + } + + for (int i=0;i> n; + dfs(0, n); + cout << sum; + return 0; +}