From 15534a7857c057e70434796b697a76af2321c815 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Wed, 30 Jun 2021 19:10:43 +0800 Subject: [PATCH] =?UTF-8?q?842.=20=E6=8E=92=E5=88=97=E6=95=B0=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acwing.com/problem/content/submission/code_detail/6187818/ --- AcWing/842/842.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 AcWing/842/842.cpp diff --git a/AcWing/842/842.cpp b/AcWing/842/842.cpp new file mode 100644 index 00000000..d6837a2f --- /dev/null +++ b/AcWing/842/842.cpp @@ -0,0 +1,18 @@ +#include + +using namespace std; + +int main() { + int n, a[10]; + cin >> n; + for (int i = 0; i < n; i++) { + a[i] = i + 1; + } + do { + for (int i = 0; i < n; i++) { + cout << a[i] << ' '; + } + cout << endl; + } while (next_permutation(a, a + n)); + return 0; +}