blob: 1788cfd7fa3896beaa24cb3443e0a4d619f17920 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
def recprism_area(l, w, h):
return 2*l*w + 2*w*h + 2*h*l
def smallest_side(l, w, h):
return min(l*w, w*h, h*l)
def ribbon_wrap(l, w, h):
di = [l, w, h]
stmin = min(di)
di.remove(stmin)
ndmin = min(di)
return 2*stmin + 2*ndmin
def ribbon_bow(l, w, h):
return l*w*h
order = 0
with open("input") as f:
for line in [l.strip() for l in f.readlines()]:
di = list(map(int, line.split("x")))
order += ribbon_wrap(*di) + ribbon_bow(*di)
print(order)
|