From 8bd714bc2b43c4bd9340caba089db0e67810f34e Mon Sep 17 00:00:00 2001 From: hanyixuanten Date: Fri, 14 Aug 2026 10:05:34 +0800 Subject: [PATCH] new file: 7.cpp --- 7.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 7.cpp diff --git a/7.cpp b/7.cpp new file mode 100644 index 0000000..b75c46c --- /dev/null +++ b/7.cpp @@ -0,0 +1,30 @@ +// 93 +#include +using namespace std; +bool ch[50]; +int n, m; +void dfs(int count, int now) +{ + if (now > n) + { + if (count != m) + return; + for (int i = 1; i <= n; ++i) + { + if (ch[i]) + printf("%d ", i); + } + puts(""); + return; + } + ch[now] = 1; + dfs(count + 1, now + 1); + ch[now] = 0; + dfs(count, now + 1); +} +int main() +{ + scanf("%d%d", &n, &m); + dfs(0, 1); + return 0; +} \ No newline at end of file