20 lines
439 B
Python
20 lines
439 B
Python
with open('input.text', 'r') as file:
|
|
data: list[str] = file.readlines()
|
|
|
|
total = 0
|
|
for line in data:
|
|
l, w, h = [int(s) for s in line.split('x')]
|
|
|
|
sides = [2*l*w, 2*w*h, 2*h*l]
|
|
|
|
area = 0
|
|
lowest = float('inf')
|
|
for side in sides:
|
|
if side/2 < lowest:
|
|
lowest = side/2
|
|
area += side
|
|
|
|
total += area + lowest
|
|
|
|
print(f'The total square feet of wrapping paper needed is {int(total)} sq. ft.')
|