diff options
author | Anastasios Grammenos <anastasios.grammenos@noris.gr> | 2020-10-26 14:20:24 +0200 |
---|---|---|
committer | Anastasios Grammenos <anastasios.grammenos@noris.gr> | 2020-10-26 14:20:24 +0200 |
commit | f6f0e5356eb01d5e19e1f1a2b9256eed1e964ddb (patch) | |
tree | d04d471737033c3c7bbe21fe6f56b3c36073b081 /3.2.py | |
parent | f28878613810f0b1b1deafe6c733522f02d0ceb6 (diff) | |
download | foobar-withgoogle-f6f0e5356eb01d5e19e1f1a2b9256eed1e964ddb.tar.gz foobar-withgoogle-f6f0e5356eb01d5e19e1f1a2b9256eed1e964ddb.tar.bz2 foobar-withgoogle-f6f0e5356eb01d5e19e1f1a2b9256eed1e964ddb.zip |
Fix for the trivial case
Diffstat (limited to '3.2.py')
-rw-r--r-- | 3.2.py | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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]])) |