Merge branch 'master' of https://github.com/Lucidiot/adventofcode
This commit is contained in:
commit
70319684ea
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
def scanner_pos(length, time):
|
||||
offset = time % ((length - 1) * 2)
|
||||
return 2 * (length - 1) - offset if offset > length - 1 else offset
|
||||
|
||||
import sys
|
||||
ranges = {k: v for (k, v) in [tuple(map(int, l.strip().split(": "))) for l in sys.stdin.readlines()]}
|
||||
print(sum(pos * ranges[pos] for pos in ranges if scanner_pos(ranges[pos], pos) == 0))
|
Loading…
Reference in New Issue