#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() const int n = 100; int grid[n][n]; int main(){ //ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); grid[0][0] = 1; for(int i = 1; i < n; i++) grid[1][i] = 1; for(int i = 2; i < n; i+= 2){ for(int j = 0; j < n; j++) grid[i][j] = 1; if(i%4 == 0){ grid[i][0] = 0; grid[i + 1][1] = 1; } else{ grid[i][n - 1] = 0; grid[i+1][n-2] = 1; } } for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++) cout << grid[i][j]; cout << "\n"; } return 0; }
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 | #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() const int n = 100; int grid[n][n]; int main(){ //ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); grid[0][0] = 1; for(int i = 1; i < n; i++) grid[1][i] = 1; for(int i = 2; i < n; i+= 2){ for(int j = 0; j < n; j++) grid[i][j] = 1; if(i%4 == 0){ grid[i][0] = 0; grid[i + 1][1] = 1; } else{ grid[i][n - 1] = 0; grid[i+1][n-2] = 1; } } for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++) cout << grid[i][j]; cout << "\n"; } return 0; } |