算法竞赛进阶指南--递归实现指数型枚举

vector<int> chosen;
void calc(int x) {
	if (x == n + 1) {
		for (int i = 0; i < chosen.size(); i++)
			printf("%d ", chosen[i]);
		puts("");
		return;
	}
	calc(x + 1);
	chosen.push_back(x);
	calc(x + 1);
	chosen.pop_back();
}
原文地址:https://www.cnblogs.com/lunatic-talent/p/12798277.html