summaryrefslogtreecommitdiff
path: root/i-was-told-there-would-be-no-math/README.org
diff options
context:
space:
mode:
Diffstat (limited to 'i-was-told-there-would-be-no-math/README.org')
-rw-r--r--i-was-told-there-would-be-no-math/README.org42
1 files changed, 42 insertions, 0 deletions
diff --git a/i-was-told-there-would-be-no-math/README.org b/i-was-told-there-would-be-no-math/README.org
new file mode 100644
index 0000000..002ba32
--- /dev/null
+++ b/i-was-told-there-would-be-no-math/README.org
@@ -0,0 +1,42 @@
+See: https://adventofcode.com/2015/day/2
+** Part 1
+*** Purpose
+Given a list of dimensions for multiple boxes in the form l \times w \times h:
+
+#+begin_example
+2x3x4
+1x1x10
+3x6x9
+#+end_example
+
+We perform following calculation:
+
+#+begin_example
+2*l*w + 2*w*h + 2*h*l
+#+end_example
+
+Plus the length of the smallest side... so:
+#+begin_example
+2*l*w + 2*w*h + 2*h*l + min(l*w, w*h, h*l)
+#+end_example
+
+*** Method
+I'm not sure why this problem is titled "I was told there would be no math"---non-creative problems like these are easy to solve.
+
+It won't be hard to make the computer do the math: I'll start with the formula---a function which takes ~l,w,~ and ~h~, and does the above.
+
+Then parse a single line.
+Then put it in a loop and total!
+
+** Part 2
+*** Purpose
+The second part just gives us a new formula...
+
+#+begin_example
+min(2*(l+w), 2(w*h), 2(h*l)) + l*w*h
+#+end_example
+
+Yay...
+
+*** Method
+Same as above