A repro for all my Advent of ode tasks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

26 lines
866 B

import os
import sys
file = open('input.txt', 'r')
wrapping_paper_area = 0;
ribbon_required = 0
for line in file:
lwh_s = line.split('x')
lwh = [int(lwh_s[0]), int(lwh_s[1]), int(lwh_s[2])]
lwh.sort()
abc = {}
abc[0] = int(lwh[0])*int(lwh[1])
abc[1] = int(lwh[1])*int(lwh[2])
abc[2] = int(lwh[2])*int(lwh[0])
print("A: " + str(abc[0]) + " B: " + str(abc[1]) + " C: " + str(abc[2]))
smallest = min(abc[0], abc[1], abc[2])
print("Smallest side: " + str(smallest))
wrapping_paper_area = wrapping_paper_area + ((abc[0]*2) + (abc[1]*2) +(abc[2]*2)) + smallest
ribbon_required = ribbon_required + ((lwh[0]*2) + (lwh[1]*2)) + (lwh[0]*lwh[1]*lwh[2])
print("The elves need " + str(wrapping_paper_area) + " square feet of wrapping paper")
print("The elves need " + str(ribbon_required) + " feet of ribbon")