Matriu permutació X87295


Statement
 

pdf   zip

Una matriu permutació és una matriu quadrada amb tots els seus elements iguals a 00 excepte un qualsevol per cada fila i columna, que ha de ser igual a 11.

Dissenyeu la funció @matriu_permutacio(mat)@, on matmat és una matriu quadrada binaria (de zeros i uns), que retorni un booleà indicant si matmat és una matriu permutació (True) o no ho és (False).

Exemple de sessió

Sample session
>>> matriu_permutacio([[0, 0, 1], [1, 0, 0], [0, 1, 0]])
True
>>> matriu_permutacio([[0, 1, 0], [0, 0, 1], [1, 0, 0]])
True
>>> matriu_permutacio([[0, 0, 1], [1, 0, 0], [0, 0, 1]])
False
>>> matriu_permutacio([[0, 1], [1, 0]])
True
Information
Author
Professors Informàtica EEBE
Language
Catalan
Official solutions
Python
User solutions
Python