Files
advent-of-code/2015/day-2/part-2.py
2024-12-06 20:57:41 +01:00

19 lines
362 B
Python

import math
import os
file_path = os.path.join(os.path.dirname(__file__), "./input.txt")
input = open(file_path).read().strip()
count = 0
for line in input.splitlines():
dimensions = sorted(map(int, line.split("x")))
[x, y, z] = dimensions
perimiter = (x + y) * 2
volume = math.prod(dimensions)
count += perimiter + volume
print(count)