Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int n;
- int main()
- {
- cin >> n;
- for(int bit = 0; bit < (1 << n); bit++) {
- cout << "{";
- for(int i = 0; i < n; i++) {
- if(bit & (1 << i)) {
- cout << i + 1 << " ";
- }
- }
- cout << "}" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement