Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def day24_part2(s):
- rows = [list(map(int, re.findall(r'[-\d]+', line))) for line in s.splitlines()]
- p, v, ts = (sympy.symbols(f'{ch}(:3)') for ch in 'pvt')
- equations = [
- row[j] + t * row[3 + j] - p[j] - v[j] * t for row, t in zip(rows, ts) for j in range(3)
- ]
- return sum(sympy.solve(equations, (*p, *v, *ts))[0][:3])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement