Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <vector>
- #include <cmath>
- using namespace std;
- const int maxn = 1e6;
- const int INF = 2e9;
- typedef long long ll;
- int n;
- int main() {
- ios_base::sync_with_stdio(false);
- cin >> n;
- for(int bitmask = 0; bitmask < (1 << n); bitmask++) {
- for(int i = 0; i < n; i++) {
- if(bitmask & (1 << i)) {
- cout << i << " ";
- }
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment