This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#include <bits/stdc++.h>
using namespace std;
int n, r;
const int N = 110;
int a[N];
void dfs(int step, int m) {
if (step == n + 1) return;
if (m == r) {
for (int i = 1; i <= r; i++) printf("%3d", a[i]);
printf("\n");
return;
}
//下一个数字选择上
a[m + 1] = step + 1;
dfs(step + 1, m + 1);
//下一个数字放弃掉
dfs(step + 1, m);
}
int main() {
cin >> n >> r;
dfs(0, 0);
return 0;
}