#include <bits/stdc++.h>
using namespace std;
//14888 ㄱㄱ
int n,m;
int arr[10];
void NM(int now_n,int last){
//기저
if(now_n==m) {
for(int i=0; i<m; i++) {
cout << arr[i] <<' ';
}
cout << '\n';
return;
}
for(int i=last; i<=n; i++) {
arr[now_n]=i;
NM(now_n+1,i);
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
NM(0,1);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: