Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
123512 | 刘子涵 | 求子集 | C++ | 通过 | 100 | 7 MS | 248 KB | 306 | 2024-01-23 08:25:55 |
#include<bits/stdc++.h> using namespace std; int n,z[20]; void dfs(int x,int y){ cout<<"("; for(int i=1;i<=y;i++) cout<<(char)(z[i]-1+'a'); cout<<")\n"; if(x==n) return; for(int t=x+1;t<=n;t++){ z[y+1]=t; dfs(t,y+1); z[y+1]=0; } } int main(){ cin>>n; dfs(0,0); return 0; }