Suppose you have a lot of boxes which can accommodate either $1, 5, 10, 20$ or $50$ items. You need to arrange $170$ items in $12$ boxes only (nothing less, nothing more). In how many ways can you make this distribution? Is there any formulae based approach to this?
Example: One solution is $10 \times 7 + 20 \times 5 = 170$, i.e., $7$ boxes of $10$ capacity and $5$ boxes of $20$ capacity.
Also, all the boxes must be filled to the full capacity.

Before a (true) mathematician brings a closed formula, here is a recursive algorithm.
Given the constraints on the sum (170) and the number of boxes (12), the complexity remains low.
Because of that, even without a computer, the number of solutions appears to be likely reasonable (it is, as the algo gives 35 solutions only).
Here is a generic code algo for $f$, a recursive function
And a C implementation
Calling
f(0,0,0);gives