Files
python/TangDou/LanQiaoBei/LanQiao13STEMA202201/Test.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

25 lines
470 B
C++

#include <bits/stdc++.h>
using namespace std;
const int N = 10;
int a[N];
bool st[N];
int n = 3;
void dfs(int u) {
if (u == n + 1) {
for (int i = 1; i <= n; i++) cout << a[i] << " ";
cout << endl;
return;
}
for (int i = 1; i <= n; i++)
if (!st[i]) {
a[u] = i;
st[i] = true;
dfs(u + 1);
st[i] = false;
}
}
int main() {
dfs(1);
return 0;
}