[Python/2018] Move solutions into .py files
This commit is contained in:
parent
edb04277c6
commit
40e767096e
60 changed files with 1518 additions and 3541 deletions
23
Python/2018/01.py
Normal file
23
Python/2018/01.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from lib import *
|
||||
|
||||
input = read_input(2018, 1)
|
||||
|
||||
out = 0
|
||||
for line in input.splitlines():
|
||||
out += int(line)
|
||||
print(out)
|
||||
|
||||
lines = input.splitlines()
|
||||
freq = 0
|
||||
seen = {0}
|
||||
while True:
|
||||
for line in lines:
|
||||
freq += int(line)
|
||||
if freq in seen:
|
||||
print(freq)
|
||||
break
|
||||
else:
|
||||
seen.add(freq)
|
||||
else:
|
||||
continue
|
||||
break
|
Loading…
Add table
Add a link
Reference in a new issue