From c8cbda666991ef6eec88c51886fe5de538090d63 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Sun, 3 Jan 2021 20:43:26 +0800 Subject: [PATCH] =?UTF-8?q?P1498=20=E5=8D=97=E8=9B=AE=E5=9B=BE=E8=85=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R44590884 --- Luogu/problem/P1498/P1498.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Luogu/problem/P1498/P1498.cpp diff --git a/Luogu/problem/P1498/P1498.cpp b/Luogu/problem/P1498/P1498.cpp new file mode 100644 index 00000000..bef1d4ac --- /dev/null +++ b/Luogu/problem/P1498/P1498.cpp @@ -0,0 +1,29 @@ +#include + +using namespace std; + +int n, a[1030] = {1}; + +int main() { + cin >> n; + for (int i = 0; i < (1 << n); i++) { + for (int j = 1; j < (1 << n) - i; ++j) { + cout << " "; + } + for (int j = i; j >= 0; j--) { + a[j] ^= a[j - 1]; + } + if (i & 1) { + for (int j = 0; j <= i; j += 2) { + cout << (a[j] ? "/__\\" : " "); + } + + } else { + for (int j = 0; j <= i; j++) { + cout << (a[j] ? "/\\" : " "); + } + } + cout << endl; + } + return 0; +} \ No newline at end of file