Day 2 - Advent of Code 2015
Working solutions for the day 2 puzzles.
Part One
""" day_02_01.py """
# usage: python3 day_02_01.py < input
import sys
paper = 0
for box in sys.stdin.read().splitlines():
x, y, z = list(map(int, box.split('x')))
paper += 2 * (x * y + x * z + y * z)
paper += min(x * y, x * z, y * z)
print(paper)
Part Two
""" day_02_02.py """
# usage: python3 day_02_02.py < input
import sys
ribbon = 0
for box in sys.stdin.read().splitlines():
x, y, z = list(map(int, box.split('x')))
ribbon += 2 * min(x + y, x + z, y + z)
ribbon += x * y * z
print(ribbon)