提交时间:2024-01-23 20:02:59

运行 ID: 125649

#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; }