first commit
This commit is contained in:
1024
01/input.txt
Normal file
1024
01/input.txt
Normal file
File diff suppressed because it is too large
Load Diff
9
01/solve01.py
Executable file
9
01/solve01.py
Executable 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
19
01/solve02.py
Executable 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)
|
||||
Reference in New Issue
Block a user