include[HTML_REMOVED]
using namespace std;
const int N=30;
int state[N];//状态数
int n,m;
void dfs(int u,int start)
{
if(u==m+1)//递归边界
{
for(int i=1;i<=m;i)
cout<<state[i]<<” “;
cout<<endl;
return ;
}
for(int i=start;i<=n;i)//保证字典序输出,start要从大于当前数开始来循环每个分支
{
state[u]=i;
dfs(u+1,i+1);
state[u]=0;//恢复现场
}
}
int main()
{
scanf(“%d%d”,&n,&m);
dfs(1,1);
return 0;
}