36 lines
679 B
Python
36 lines
679 B
Python
from tools.aoc import AOCDay
|
|
from typing import Any
|
|
|
|
|
|
class Day(AOCDay):
|
|
inputs = [
|
|
[
|
|
(522, "input1")
|
|
],
|
|
[
|
|
(73364, "input1")
|
|
]
|
|
]
|
|
|
|
def part1(self) -> Any:
|
|
return sum(self.getInputListAsType(int))
|
|
|
|
def part2(self) -> Any:
|
|
seen = set()
|
|
freqs = self.getInputListAsType(int)
|
|
cur_freq = 0
|
|
while True:
|
|
for f in freqs:
|
|
cur_freq += f
|
|
if cur_freq in seen:
|
|
return cur_freq
|
|
else:
|
|
seen.add(cur_freq)
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
day = Day(2018, 1)
|
|
day.run(verbose=True)
|