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();
}
算法竞赛进阶指南--递归实现指数型枚举
猜你喜欢
转载自blog.csdn.net/weixin_43627118/article/details/105507032
今日推荐
周排行