Advertisement
MadCortez

Untitled

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