Advertisement
allia

симметричность рабочая

Sep 22nd, 2020
1,278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <string>
  4. #include <algorithm>
  5. using namespace std;
  6.  
  7. void obxod (int **arr, int a, int b)
  8. {
  9.   int x=0, y=0;
  10.  
  11.  for (int i=0; i<a; i++)
  12.   for (int j=0; j<b; j++)
  13.   {
  14.     if (arr[i][j]==arr[a-i-1][j])
  15.      x++;
  16.     if (arr[i][j]==arr[i][b-j-1])
  17.      y++;
  18.      
  19.   }
  20.  
  21.   if (x==a*b || y==a*b || (x==a*b && y==a*b))
  22.    cout << "Yes";
  23.   else cout << "No";
  24. }
  25.  
  26. int main ()
  27. {
  28.   int n=0, m=0, **arr, c=0;
  29.   cin >> n >> m;
  30.  
  31.   arr = new int* [n];
  32.   for (int i=0; i<n; i++)
  33.   arr[i] = new int [m];
  34.  
  35.   for (int i=0; i<n; i++)
  36.    for (int j=0; j<m; j++)
  37.    cin >> arr[i][j];
  38.  obxod (arr, n, m);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement