Advertisement
STANAANDREY

sim 2021 III 2

May 10th, 2021
1,105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. #define NMAX 103
  4. int a[NMAX][NMAX], n;
  5.  
  6. int main() {
  7.     cin >> n;
  8.     for (int i = 1; i <= n; i++) {
  9.         for (int j = 1; j <= n; j++) {
  10.             cin >> a[i][j];
  11.         }
  12.     }
  13.     for (int i = 1; i < n; i++) {
  14.         cout << a[i][1] << ' ';
  15.     }
  16.     for (int j = 1; j < n; j++) {
  17.         cout << a[n][j] << ' ';
  18.     }
  19.     for (int i = n; i > 1; i--) {
  20.         cout << a[i][n] << ' ';
  21.     }
  22.     for (int j = n; j > 1; j--) {
  23.         cout << a[1][j] << ' ';
  24.     }
  25.     return 0;
  26. }
  27.  
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement