mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 13:58:48 +00:00
842. 排列数字
https://www.acwing.com/problem/content/submission/code_detail/6187818/
This commit is contained in:
parent
7390c1003d
commit
15534a7857
18
AcWing/842/842.cpp
Normal file
18
AcWing/842/842.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include <bits/stdc++.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user