文章
4
粉丝
204
获赞
3
访问
12.4k
#include<iostream>
#include<vector>
using namespace std;
vector<int> path;
vector<vector<int>> result;
void backtracking(int n, int r, int index) {
if (path.size() == r) {
result.push_back(path);
return;
}
for (int i = index; i <= n; i++) {
path.push_back(i);
backtracking(n, r, i + 1);
path.pop_back();
}
}
int main() {
int n, r;
while (cin>>n>>r)
{
if (n == 0 && r == 0) {
break;
}
if (r > n) {
&nb...
登录后发布评论
暂无评论,来抢沙发