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; +}