Files
advent-of-code/2015/day-2/python/main.py
2019-11-22 23:21:06 -06:00

22 lines
412 B
Python

import os
import sys
PATH = os.path.join(sys.path[0], '..', 'input')
DATA = open(PATH).readlines()
paper = 0
ribbon = 0
for line in DATA:
l, w, h = list(map(int, line.split('x')))
areas = [l*w, w*h, h*l]
volume = l*w*h
perimeters = [2*(l+w), 2*(h+w), 2*(h+l)]
areas.extend(areas)
paper += sum(areas) + min(areas)
ribbon += min(perimeters) + volume
print(paper)
print(ribbon)