blob: 002ba32ee97a408c0c276e6a48f65ce92cec5251 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
|