#include <bits/stdc++.h>
#define ll long long
#define fors(u, n, s) for(ll u = (s); u < (n); u++)
#define foru(u, n) fors(u, n, 0)
#define f first
#define s second
#define vec vector
#define pb push_back
#define ir(a, b, x) (((a) <= (x)) && ((x) <= (b)))
using namespace std;
const int N = 100;
bool image[N][N];
int main() {
//cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
image[0][1] = true;
fors(x, N, 1) image[x][0] = true;
int y = 2;
while(true){
fors(x, N, 0) image[x][y] = true;
image[N-1][y] = false;
y ++;
if(y >= N) break;
fors(x, N, 0) image[x][y] = true;
image[0][y] = false;
foru(x, N) image[x][y] = !image[x][y];
y ++;
if(y >= N) break;
}
//image[N-1][1] = false;
foru(i, N){
foru(j, N) {
cout << image[i][j];
}
cout << endl;
}
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #include <bits/stdc++.h> #define ll long long #define fors(u, n, s) for(ll u = (s); u < (n); u++) #define foru(u, n) fors(u, n, 0) #define f first #define s second #define vec vector #define pb push_back #define ir(a, b, x) (((a) <= (x)) && ((x) <= (b))) using namespace std; const int N = 100; bool image[N][N]; int main() { //cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); image[0][1] = true; fors(x, N, 1) image[x][0] = true; int y = 2; while(true){ fors(x, N, 0) image[x][y] = true; image[N-1][y] = false; y ++; if(y >= N) break; fors(x, N, 0) image[x][y] = true; image[0][y] = false; foru(x, N) image[x][y] = !image[x][y]; y ++; if(y >= N) break; } //image[N-1][1] = false; foru(i, N){ foru(j, N) { cout << image[i][j]; } cout << endl; } return 0; } |
English