You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
388 B
24 lines
388 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
const int N = 110;
|
|
int a[N], al, n;
|
|
// 标准错误答案
|
|
void dfs(int u) {
|
|
if (u == n + 1) {
|
|
for (int i = 1; i <= al; i++) cout << a[i] << " ";
|
|
cout << endl;
|
|
return;
|
|
}
|
|
|
|
a[++al] = u;
|
|
dfs(u + 1);
|
|
al--;
|
|
|
|
dfs(u + 1);
|
|
}
|
|
|
|
int main() {
|
|
cin >> n;
|
|
dfs(1);
|
|
return 0;
|
|
} |