Add 2021-1

This commit is contained in:
Tobias Reisinger 2023-12-02 03:26:37 +01:00
commit 7aa8eaec32
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
2 changed files with 2020 additions and 0 deletions

2000
1/input Normal file

File diff suppressed because it is too large Load diff

20
1/solution.py Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env python
def get_positive_changes(values):
count = 0
for i in range(1, len(values)):
if int(values[i - 1]) < int(values[i]):
count += 1
return count
if __name__ == '__main__':
f = open("input", "r")
values = f.readlines()
print('1. solution:', get_positive_changes(values))
new_values = []
for i in range(2, len(values)):
new_values.append(int(values[i]) + int(values[i-1]) + int(values[i-2]))
print('2. solution:', get_positive_changes(new_values))