#include "bits/stdc++.h" using namespace std; void increase_dim(deque<deque<int>> &A) { A.back().push_back(0); for (int i = 0; i < A.size() - 1; i++) A[i].push_back(1); deque<int> tmp; for (int i = 0; i < A.back().size() - 1; i++) tmp.push_back(0); tmp.push_back(1); A.push_front(tmp); A[0].push_front(0); for (int i = 1; i < A.size(); i++) A[i].push_front(1); reverse(tmp.begin(), tmp.end()); tmp.push_back(0); A.push_back(tmp); } int main() { deque<deque<int>> A; A = {{0, 0, 0, 0, 1}, {1, 0, 1, 1, 1}, {1, 0, 1, 0, 1}, {1, 1, 0, 0, 0}, {1, 0, 0, 0, 0}}; for(int i=0; i<95/2; i++) increase_dim(A); for(int i=0; i<A.size()-1; i++) A[i].push_back(1); A.back().push_back(0); deque<int> tmp; for(int i=0; i<A.back().size()-1; i++) tmp.push_back(0); tmp.push_back(1); A.push_front(tmp); for(auto aa : A) { for(auto a : aa) cout << a; cout << '\n'; } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include "bits/stdc++.h" using namespace std; void increase_dim(deque<deque<int>> &A) { A.back().push_back(0); for (int i = 0; i < A.size() - 1; i++) A[i].push_back(1); deque<int> tmp; for (int i = 0; i < A.back().size() - 1; i++) tmp.push_back(0); tmp.push_back(1); A.push_front(tmp); A[0].push_front(0); for (int i = 1; i < A.size(); i++) A[i].push_front(1); reverse(tmp.begin(), tmp.end()); tmp.push_back(0); A.push_back(tmp); } int main() { deque<deque<int>> A; A = {{0, 0, 0, 0, 1}, {1, 0, 1, 1, 1}, {1, 0, 1, 0, 1}, {1, 1, 0, 0, 0}, {1, 0, 0, 0, 0}}; for(int i=0; i<95/2; i++) increase_dim(A); for(int i=0; i<A.size()-1; i++) A[i].push_back(1); A.back().push_back(0); deque<int> tmp; for(int i=0; i<A.back().size()-1; i++) tmp.push_back(0); tmp.push_back(1); A.push_front(tmp); for(auto aa : A) { for(auto a : aa) cout << a; cout << '\n'; } } |