eolymp
bolt
Try our new interface for solving problems
Problems

Матриця 2

published at 2/22/24, 8:02:46 pm

include <bits/stdc++.h>

define ll long long

define str string

using namespace std; int main(){

ll n, m = 0;
cin>>n;
ll arr[n][n];
for(int i = 0; i<n; i++){
    for(int j = 0; j<n; j++){
        if((i%2 == 0 && j%2 == 0) || (i%2 != 0 && j%2 != 0)){
            arr[i][j]=0;
        }
        else{
            arr[i][j]=1;
        }
    }
}
for(int i = 0; i<n; i++){
    cout<<endl;
    for(int j = 0; j<n; j++){
        cout<<arr[i][j];
    }
}

}