Continue with 2016 and 2017.
This commit is contained in:
26
2017/d2.py
Normal file
26
2017/d2.py
Normal 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)
|
||||
|
||||
Reference in New Issue
Block a user