2015 day 2part 1 & 2

This commit is contained in:
Xevion
2019-11-22 23:21:06 -06:00
parent 2eb9693fdd
commit b54a3a8148
2 changed files with 1022 additions and 0 deletions

1000
2015/day-2/input Normal file
View File

File diff suppressed because it is too large Load Diff

22
2015/day-2/python/main.py Normal file
View File

@@ -0,0 +1,22 @@
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)