1
0
Fork 0
advent-of-code/2015/aoc_d2p1.py

24 lines
399 B
Python
Raw Permalink Normal View History

2024-02-08 09:55:40 +01:00
#!/usr/bin/env python
total = 0
with open("inputd2.txt", "r") as f:
for line in f:
dimensions = [int(x) for x in line.split("x")]
l = dimensions[0]
w = dimensions[1]
h = dimensions[2]
lw = l * w
wh = w * h
hl = h * l
smallest = wh
if (lw < hl and lw < wh):
smallest = lw
elif (hl < wh):
smallest = hl
total += (2 * lw) + (2 * hl) + (2 * wh) + smallest
print(total)