Advertisement
Infiniti_Inter

Дело смерти или жизни[Автомата]

Dec 16th, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int n;
  7. void del(int** a, int row, int cow)
  8. {
  9.     for (int i = row; i + 1 < n; ++i)
  10.         for (int j = 0; j < n; ++j)
  11.             a[i][j] = a[i + 1][j];
  12.     for (int j = cow; j + 1 < n; ++j)
  13.         for (int i = 0; i < n; ++i)
  14.             a[i][j] = a[i][j + 1];
  15.     n--;
  16. }
  17. int main()
  18. {
  19.     cin >> n;
  20.     int** a = new int* [n];
  21.     for (int i = 0; i < n; ++i)
  22.         a[i] = new int[n];
  23.     for (int i = 0; i < n; ++i)
  24.         for (int j = 0; j < n; ++j)
  25.             cin >> a[i][j];
  26.     int k, j;
  27.     bool fl = true;
  28.     cin >> k >> j;
  29.     k--, j--;
  30.     for (int i = 0; i < n; ++i)
  31.         if (a[k][i] != a[i][j])
  32.         {
  33.             fl = false;
  34.             break;
  35.         }
  36.     if (fl)
  37.         del(a, k, j);
  38.     for (int i = 0; i < n; ++i)
  39.     {
  40.         for (int j = 0; j < n; ++j)
  41.             cout << a[i][j] << ' ';
  42.         cout << endl;
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement