Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
125649 | 陈未一 | 求子集 | C++ | 通过 | 100 | 160 MS | 2812 KB | 365 | 2024-01-23 20:02:59 |
#include<bits/stdc++.h> using namespace std; int N; set <string> s; void Subset(int n){ string str="("; for(int i=0; i<N; i++) if((1<<i)&n) str+=char(i+'a'); str+=")"; s.insert(str); } int main(){ cin>>N; for(int i=0; i<(1<<N); i++) Subset(i); for(auto ii=s.begin(); ii!=s.end(); ii++) cout<<*ii<<endl; return 0; }