adventofcode/2017/02/2checksum.py
2025-07-24 23:07:02 +00:00

22 lines
668 B
Python
Executable File

#!/usr/bin/env python3
if __name__ == '__main__':
total = 0
with open("input", "r", encoding="utf-8") as sheet:
remainder = []
for line in sheet:
values = list(map(int, line.split()))
values.sort()
result = ""
i = 1
while i < len(values) and result == "":
j = 0
while j >= 0 and j < i and result == "":
remainder = values[i] % values[j]
if remainder == 0:
result = int(values[i] / values[j])
j += 1
i += 1
total += result
print(total)