Our input has bounds $1 \leq n, a, b, c \leq 4000$, with $n$ as the initial length, and $a, b, c$ as valid cutting lengths. We want to maximize the number of pieces, but each piece must be a valid cutting length.
Dynamic programming is a good fit for this problem, because there are overlapping subproblems; starting from one end, cutting a length off, we then ask an identical question for the remaining length. Also, we are guaranteed a solution for this problem, as given in the description.
Here's another (admittedly inferior) way some people might choose to implement it, using two dimensions for our memoization table instead of just the one. It is also accepted, but uses quite a bit more memory; stricter problem constraints might make this type of solution fail, but it can be a bit clearer because you don't have to adjust the final answer to get the correct result. This is only feasible because of the $n \leq 4000$ bound.