C++ 代码
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<vector>
#include<cstdio>
#include <iomanip>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 0; i != 1 << n; ++i)
{
for (int j = 0; j != n; ++j)
if (i & (1 << j))
cout << j + 1 << ' ';
cout << endl;
}
return 0;
}
算法2
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla