1317:【例5.2】组合的输出
作者:互联网
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 }
标签:1317,输出,5.2,组合,int,solve,include 来源: https://www.cnblogs.com/sxrekord/p/combined_output.html