Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <fstream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <algorithm>
  5.  
  6. using namespace std ;
  7.  
  8. ifstream cin ("input") ;ofstream cout ("output") ;
  9.  
  10. vector < string > v;
  11. vector < string > aux;
  12.  
  13. int main()
  14. {
  15.     int n;
  16.     cin>>n;
  17.  
  18.     v.push_back("0");
  19.     v.push_back("1");
  20.  
  21.     for (int i=1; i<n; i++){
  22.         aux = v;
  23.         reverse(aux.begin() , aux.end());
  24.         for (auto &x : v){
  25.             x += "0";
  26.         }
  27.         for (auto &x : aux){
  28.             v.push_back(x + "1");
  29.         }
  30.     }
  31.  
  32.     for (auto &x : v){
  33.         cout<<x<<'\n';
  34.     }
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement