summaryrefslogtreecommitdiff
path: root/2015/02/nomath.py
diff options
context:
space:
mode:
authorboredpasta <boredpasta@tutanota.com>2025-01-13 07:00:52 +0200
committerboredpasta <boredpasta@tutanota.com>2025-01-13 07:22:23 +0200
commitf85949f85266768ec1bd5e3d150e4ac71feabcf1 (patch)
treea6c81c5ec164d209bf0e664d6a6a22ddd42cd63f /2015/02/nomath.py
parentaf9283db3825dbfede0a4127a004f0b077fe6f7c (diff)
Add project filesHEADmaster
Diffstat (limited to '2015/02/nomath.py')
-rw-r--r--2015/02/nomath.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/2015/02/nomath.py b/2015/02/nomath.py
new file mode 100644
index 0000000..1788cfd
--- /dev/null
+++ b/2015/02/nomath.py
@@ -0,0 +1,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)