first commit

This commit is contained in:
Peter Hudec
2018-12-13 19:09:30 +01:00
commit 9f3e899cda
9 changed files with 2750 additions and 0 deletions

1024
01/input.txt Normal file

File diff suppressed because it is too large Load Diff

9
01/solve01.py Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env python
start = 0
with open('input.txt', 'r') as f:
for line in f:
start += int(line)
print(start)

19
01/solve02.py Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env python
start = 0
seen = [0]
def get_freq_change():
while True:
print('reading file from start')
with open('input.txt', 'r') as f:
for line in f:
yield int(line)
for change in get_freq_change():
start += change
if start in seen:
break
seen.append(start)
print(start)