summaryrefslogtreecommitdiffstats
path: root/3.2.py
diff options
context:
space:
mode:
Diffstat (limited to '3.2.py')
-rw-r--r--3.2.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/3.2.py b/3.2.py
index 8006d21..f7dfc04 100644
--- a/3.2.py
+++ b/3.2.py
@@ -258,7 +258,6 @@ def getMatrixInverse(m):
cofactors[r][c] = cofactors[r][c]/d
return cofactors
-
def find_lcm(a):
lcm = a[0]
for i in a[1:]:
@@ -276,6 +275,8 @@ def simplify(b):
return c
def solution(m):
+ if len(m) == 1:
+ return [1,1]
m = sort(m)
n = normalize(m,use_fractions=True)
(q, r) = decompose(n)
@@ -300,3 +301,13 @@ print(solution([[0, 1, 0, 0, 0, 1],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0]]))
# [0, 3, 2, 9, 14]
+
+print(solution([[0, 1, 31, 10, 1, 1],
+ [11, 0, 1, 23, 0, 0],
+ [51, 1, 0, 1, 0, 0],
+ [21, 31, 51, 0, 0, 1],
+ [0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0]]))
+
+# THE TRIVIAL FucKING CASE
+print(solution([[0]]))