three first days on first try!
This commit is contained in:
17
d02/part1.py
Normal file
17
d02/part1.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import sys
|
||||
|
||||
def processline(l):
|
||||
# a x b x c
|
||||
(a,b,c) = tuple(map(int,l.split('x')))
|
||||
print(l, a,b,c)
|
||||
s1 = a * b
|
||||
s2 = a * c
|
||||
s3 = b * c
|
||||
slack = min(s1,s2,s3)
|
||||
return 2*(s1+s2+s3)+slack
|
||||
|
||||
R = 0
|
||||
for l in sys.stdin.readlines():
|
||||
n = processline(l[:-1])
|
||||
R += n
|
||||
print(R)
|
16
d02/part2.py
Normal file
16
d02/part2.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import sys
|
||||
|
||||
def processline(l):
|
||||
# a x b x c
|
||||
(a,b,c) = tuple(map(int,l.split('x')))
|
||||
print(l, a,b,c)
|
||||
A = sorted([a,b,c])
|
||||
s1 = A[0]
|
||||
s2 = A[1]
|
||||
return 2*(s1+s2)+a*b*c
|
||||
|
||||
R = 0
|
||||
for l in sys.stdin.readlines():
|
||||
n = processline(l[:-1])
|
||||
R += n
|
||||
print(R)
|
Reference in New Issue
Block a user