Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void init(int arr[], int n)
  6. {
  7.     for (int i = 0; i < n; i++)
  8.     {
  9.         cin >> arr[i];
  10.     }
  11. }
  12.  
  13. bool isSimetric(int arr[], int n)
  14. {
  15.     int mid = n / 2;
  16.  
  17.     for (int i = 0; i < mid; i++)
  18.     {
  19.         if (arr[i] != arr[n - i - 1])
  20.         {
  21.             return false;
  22.         }
  23.     }
  24.  
  25.     return true;
  26. }
  27.  
  28. int main()
  29. {
  30.     int M[50], N[50], R[50];
  31.     int n;
  32.     cin >> n;
  33.    
  34.     init(M, n);
  35.     init(N, n);
  36.     init(R, n);
  37.    
  38.     int br = 0;
  39.     if (isSimetric(M, n))
  40.     {
  41.         br++;
  42.     }
  43.     if (isSimetric(N, n))
  44.     {
  45.         br++;
  46.     }
  47.     if (isSimetric(R, n))
  48.     {
  49.         br++;
  50.     }
  51.  
  52.     cout << br << endl;
  53.    
  54.     return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement