Continue with 2016 and 2017.

This commit is contained in:
2024-05-04 09:25:24 -04:00
parent 6e0cd511cc
commit 29ab4f3496
6 changed files with 479 additions and 1 deletions

26
2017/d2.py Normal file
View File

@@ -0,0 +1,26 @@
from lib import *
data = open(0).read().strip()
m = list(map(str_to_ints, data.splitlines()))
s = 0
for row in m:
s += (max(row) - min(row))
print(s)
s = 0
for row in m:
for i in range(len(row)):
for j in range(i + 1, len(row)):
if row[i] % row[j] == 0:
s += row[i] // row[j]
if row[j] % row[i] == 0:
s += row[j] // row[i]
print(s)