文件目录

#include <iostream>
#include <iomanip>
using namespace std;
int n, r;
int ans[30];
void dfs(int d, int x)
{
    if (d == r)
    {
        for (int i = 1; i <= r; i++)
            cout << setw(3) << ans[i];
        cout << '\n';
        return;
    }
    for (int i = x + 1; i <= n; i++)
    {
        ans[d + 1] = i;
        dfs(d + 1, i);
    }
}
int main()
{
    cin >> n >> r;
    for (int i = 1; i <= n; i++)
    {
        ans[1] = i;
        dfs(1, i);
    }
    return 0;
}