Advertisement
MadCortez

Untitled

Dec 2nd, 2020
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int a[100][100];
  8.     int n, m;
  9.     int b[100];
  10.     cin >> n >> m;
  11.     for (int i = 0; i < n; i++)
  12.         for (int j = 0; j < m; j++)
  13.             cin >> a[i][j];
  14.  
  15.     for (int i = 0; i < n; i++) {
  16.         int temp = 0;
  17.         for (int j = 0; j < m / 2; j++)
  18.             if (a[i][j] == a[i][m - j - 1])
  19.                 temp++;
  20.             else
  21.                 break;
  22.         if (temp == m / 2)
  23.             b[i] = 1;
  24.         else
  25.             b[i] = 0;
  26.     }
  27.     for (int i = 0; i < n; i++)
  28.         cout << b[i] << " ";
  29.     return 0;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement