Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def day13(s, *, part2=False):
- total = 0
- for s2 in s.split('\n\n'):
- values = np.array([re.findall(r'\d+', line) for line in s2.splitlines()], int)
- if part2:
- values[2] += 10_000_000_000_000
- x = sympy.Matrix(values[:2].T).LUsolve(sympy.Matrix(values[2]))
- if all(elem.is_Integer for elem in x):
- total += x[0] * 3 + x[1]
- return total
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement