提交时间:2023-08-25 10:04:19
运行 ID: 100243
#include<bits/stdc++.h> using namespace std; int n, m, a[25]; void dfs(int x){ if (x == m){ for(int i = 0; i < x; i++){ cout << a[i]; } cout << endl; } else { a[x] = a[x - 1] + 1; for (; a[x] <= n; a[x]++){ dfs(x + 1); } } } int main(){ cin >> n >> m; dfs(0); return 0; }