aboutsummaryrefslogtreecommitdiff
path: root/c/151_esMatrizIdentidad.cpp
blob: ba6dd34ee735f4f32125c1b347a953bf2724e11c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>

void solveMatrix(int size) {
	int value;
	int wrong = 0;
	for (int row = 0; row < size; row++) {
		for (int col = 0; col < size; col++) {
			std::cin >> value;
			if ( (col == row && value != 1) || (col != row && value != 0) ) {
				wrong = 1;
			}
		}
	}
	if (wrong)
		std::cout << "NO\n";
	else
		std::cout << "SI\n";
}

int main() {
	int size;
	std::cin >> size;
	while (size != 0) {
		solveMatrix(size);
		std::cin >> size;
	}
	return 0;
}