Josif_tepe

Untitled

Feb 11th, 2026
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <vector>
  4. #include <cmath>
  5. using namespace std;
  6. const int maxn = 1e6;
  7. const int INF = 2e9;
  8. typedef long long ll;
  9.  
  10. int n;
  11.  
  12.  
  13. int main() {
  14.     ios_base::sync_with_stdio(false);
  15.     cin >> n;
  16.    
  17.     for(int bitmask = 0; bitmask < (1 << n); bitmask++) {
  18.         for(int i = 0; i < n; i++) {
  19.             if(bitmask & (1 << i)) {
  20.                 cout << i << " ";
  21.             }
  22.         }
  23.         cout << endl;
  24.     }
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment