#include<bits/stdc++.h> using namespace std; int a[101]; int m,n; void s(int k){ int i; if(k>m){ for(i=1;i<=m;i++){ cout<<setw(3)<<a[i]; } cout<<endl; return; } for(i=a[k-1]+1;i<=n;i++){ a[k]=i; s(k+1); } return; } int main(){ cin>>n>>m; s(1); return 0; }
标签:std,输出,组合,int,dfs,101 From: https://www.cnblogs.com/Ahuang1A/p/17573465.html