mirror of
https://github.com/Xevion/advent-of-code.git
synced 2025-12-06 17:14:20 -06:00
22 lines
412 B
Python
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) |