#include <iostream> #include <fstream> #include <bitset> using namespace std; int n,nr; bitset<9000> afisat, exp; bool mda = false; bool ck_bit(int nr, int poz){ if((1<<poz)&nr) return true; return false; } int config; ofstream fout ("rez.out"); void make_config(int nr){ for(int i = 0 ; i<n; ++i) if(!ck_bit(nr,i)){ int cn = nr; cn = nr | (1<<i); if(!afisat[cn]){ for(int i = n-1; i>=0; --i) if(ck_bit(cn, i)) cout << 1; else cout << 0; cout << "\n"; afisat[cn] = true; } } for(int i = 0 ; i<n; ++i) if(!ck_bit(nr, i)){ if(!exp[nr|(1<<i)]){ make_config((nr|(1<<i))); exp[nr|(1<<i)] = true; } } } int main() { cin >> n; if(!afisat[nr]){ for(int i = n-1; i>=0; --i) if(ck_bit(nr, i)) cout << 1; else cout << 0; cout << "\n"; afisat[nr] = true; } make_config(0); // // while(nr < (1<<n)){ // // if(1 == 1){ // for(int i = n-1; i>=0; --i) // if(ck_bit(i)) // cout << 1; // else cout << 0; // cout << "\n"; // config ++; // } return 0; }