Advertisement
Josif_tepe

Untitled

Mar 18th, 2022
730
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <queue>
  5. #include <algorithm>
  6. #include <cstring>
  7. #include <fstream>
  8. #include <map>
  9. using namespace std;
  10.  
  11. int main() {
  12.     ios_base::sync_with_stdio(false);
  13.     int n;
  14.     cin >> n;
  15.     string s;
  16.     cin >> s;
  17.     for(int i = 0; i < (1 << n); i++) {
  18.         string t = "";
  19.         for(int j = 0; j < n; j++) {
  20.             if(i & (1 << j)) {
  21.                 t += "a";
  22.             }
  23.             else {
  24.                 t += "b";
  25.             }
  26.         }
  27.         cout << t << endl;
  28.     }
  29.     return 0;
  30. }
  31. //1753531933519559931371191113597
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement