Advertisement
Ritam_C

Uri 1534

Jan 21st, 2021
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5.     ios_base::sync_with_stdio(false);
  6.     cin.tie(NULL);
  7.     int n;
  8.     while(cin >> n){
  9.         for(int i = 0; i < n; i++){
  10.             for(int j = 0; j < n; j++){
  11.                 if(i == j){
  12.                     if(n%2 == 1 && i == n/2){
  13.                         cout << "2";
  14.                     } else{
  15.                         cout << "1";
  16.                     }
  17.                 } else if(j == n-i-1){
  18.                     cout << "2";
  19.                 } else{
  20.                     cout << "3";
  21.                 }
  22.             }
  23.             cout << "\n";
  24.         }
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement