1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 5 const int N=25; 6 int n,r,a[N]; 7 8 void solve(int l,int b){ 9 if(l>r){ 10 for(int i=1;i<=r;i++) 11 printf("%3d",a[i]); 12 cout<<endl; 13 }else{ 14 for(int i=b;i<=n;i++){ 15 a[l]=i; 16 solve(l+1,i+1); 17 } 18 } 19 } 20 int main(){ 21 cin>>n>>r; 22 solve(1,1); 23 return 0; 24 }