Compare commits

..

No commits in common. "dd0989dafdf5f7a2bb15d61f79ba282717080f7e" and "eb95c2147ee090ce73f7efcc1cdce1ec46b62e1b" have entirely different histories.

2 changed files with 0 additions and 32 deletions

View File

@ -1,32 +0,0 @@
text: str = open("example.txt", "r").read()
_value: int = 0
lines = text.splitlines()
def get_difference(values: [int]):
lst = []
for i in range(0, len(values) - 1):
lst.append(values[i + 1] - values[i])
return lst
def get_next(derives: [[int]]):
value = 0
for values in derives[::-1]:
if (len(values) == 0):
continue
value = values[0] - value
return value
for line in lines:
values = list(map(int, line.split()))
derives: [[int]] = [values]
lst = values
while True:
lst = get_difference(lst)
derives.append(lst)
if (lst.count(0) == len(lst)):
break
_value += get_next(derives)
print(_value)