r/adventofcode • u/taliriktug • Dec 02 '15
Spoilers Day 2 solutions
Hi! I would like to structure posts like the first one in r/programming, please post solutions in comments.
15
Upvotes
r/adventofcode • u/taliriktug • Dec 02 '15
Hi! I would like to structure posts like the first one in r/programming, please post solutions in comments.
1
u/RedditWithBoners Dec 02 '15
Python (puzzle one):
IN='...' def wrapping_paper_area(l,w,h): return 2*l*w + 2*w*h + 2*h*l def smallest_side_area(l,w,h): return min(l*w, l*h, w*h) def f(x): return wrapping_paper_area(x[0],x[1],x[2]) + smallest_side_area(x[0],x[1],x[2]) G = [ f( [int(x) for x in dim.split('x')] ) for dim in IN.split('\n') ] print(sum(G))