#include<bits/stdc++.h> using namespace std; int n; int ans[101][101]; int main(){ ios::sync_with_stdio(false);cin.tie(0); n=100; for(int i=1; i<=n ;i++){ if(i%2==0 || i==1){ for(int j=3; j<=n ;j+=2) ans[i][j]=1; } else{ for(int j=1; j<=n ;j+=2) ans[i][j]=1; ans[i][n]=1; } } for(int i=1; i<=n ;i++){ for(int j=1; j<=n ;j++){ cout << (ans[i][j]^((i+j)%2)); } 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 | #include<bits/stdc++.h> using namespace std; int n; int ans[101][101]; int main(){ ios::sync_with_stdio(false);cin.tie(0); n=100; for(int i=1; i<=n ;i++){ if(i%2==0 || i==1){ for(int j=3; j<=n ;j+=2) ans[i][j]=1; } else{ for(int j=1; j<=n ;j+=2) ans[i][j]=1; ans[i][n]=1; } } for(int i=1; i<=n ;i++){ for(int j=1; j<=n ;j++){ cout << (ans[i][j]^((i+j)%2)); } cout << '\n'; } } |