提交时间:2022-07-31 21:23:22

运行 ID: 55926

#include<bits/stdc++.h> using namespace std; int a,b[100],c[100],e=6; void dfs(int d){ if(d>e){ for(int i=1;i<=e;i++){ cout<<c[i]<<" "; } cout<<endl; return; } for(int i=c[d-1]+1;i<=b[a];i+=(b[d]-b[d-1])){ c[d]=b[i]; dfs(d+1); } } int main(){ while(a!=-1){ cin>>a; if(a==0) break; for(int i=1;i<=a;i++){ cin>>b[i]; } dfs(b[1]); cout<<endl; } return 0; }