AdventOfCode/2015/day2/part1.py

22 lines
518 B
Python
Raw Normal View History

2023-12-04 15:24:46 +01:00
#!/bin/python3
import sys
from pprint import pprint
input_f = sys.argv[1]
result = 0
with open(input_f) as file:
for line in file:
2023-12-04 15:44:48 +01:00
tmp = line.rstrip().split('x')
tmp = list(map(int,tmp))
first = tmp[0] * tmp[1]
second = tmp[1] * tmp[2]
third = tmp[2] * tmp[0]
#2*l*w + 2*w*h + 2*h*l
2023-12-04 17:13:33 +01:00
smallest = min(first,second,third)
2023-12-04 15:44:48 +01:00
#print(first,second, third, smallest)
result = result + (2*first) + (2*second) + (2*third) + smallest
print(result)