Untitled
unknown
plain_text
3 years ago
464 B
18
Indexable
#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;
}Editor is loading...