提交时间:2023-08-25 15:50:04

运行 ID: 100398

#include <bits/stdc++.h> #define endl '\n' using namespace std; int n,m; int a[114]; int cnt=0; void dfs(int x) { if(x>m) { for(int i = 1; i <= m; i++)cout << a[i]; cout << endl; return; } for(int i = a[x-1]+1; i <= n; i++) { a[x]=i; dfs(x+1); } } signed main() { cin >> n >> m; dfs(1); return 0; }