fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int N;
  6. cin >> N;
  7.  
  8. int matriz[N][N];
  9. for (int i = 0; i < N; i++) {
  10. for (int j = 0; j < N; j++) {
  11. cin >> matriz[i][j];
  12. }
  13. }
  14. bool diagonalesIguales = true;
  15.  
  16. for (int i = 0; i < N; i++) {
  17. if (matriz[i][i] != matriz[i][N-i-1]) {
  18. diagonalesIguales = false;
  19. break;
  20. }
  21. }
  22. if (diagonalesIguales) {
  23. cout << "Iguales " << endl;
  24. } else {
  25. cout << "No iguales" << endl;
  26. }
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 5284KB
stdin
6
1 1 1 1 1 1
1 1 3 0 1 1
1 2 1 1 1 1
4 3 3 3 3 3
5 1 1 1 1 5
6 1 2 2 1 6
stdout
Iguales