Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
464 B
13
Indexable
Never
#include <bits/stdc++.h>
 
using namespace std;

int p[20], n;

void rec(int pos, int k) {
    p[pos] = k;
    if (pos == n) {
        for (int i = n; i >= 1; --i) {
            cout << p[i];
        }
        cout << endl;
    } else {
        for (int k = 0; k < 2; ++k) {
            rec(pos + 1, k);
        }
    }
}

int main() {              
    cin >> n;
    for (int k = 0; k < 2; ++k) {
        rec(1, k);
    }
    return 0;
}