Simple solution to combinations with limited repetition Suppose that you are going to prepare a fruit salad with oranges, apples, and bananas. The salad should consist of 10 pieces. No fruit should be used more than 5 times.
Without the constraint, the solution would be

with $n=10$ and $k=3$, I believe.
However, the problem has a constraint. A straigthforward approach would be: If there are zero bananas, then there is one possible distribution of apples and oranges (only (5,5) would yield 10). If there are 5 bananas, there are 6 possible distributions (5,5), (4,1), (3,2) ...).
This yields $6 + 5 + 4 + 3 + 2 + 1 = 21$ in total.
Is there a more efficient and more generalizable approach that would easily work with more fruits?
I am not looking for solving this with the inclusion-exclusion approach, which is possible for any constraint (right?). I am also not looking for dynamic programming or anything like that.
I found the exercise in a textbook about the basics of combinatorics, so I assume that there must be a simple solution using the typical combinatorics formulas that works in the special case where the constraint is the same for all the fruits involved (i.e. in contrast to different limits per fruit).
Any advice is appreciated!

To be found are the number of tuples $(o,a,b)$  with $o+a+b=10$ under constraint:$$(o,a,b)\in\{0,1,2,3,4,5\}^3$$
Setting $o'=5-o$, $a'=5-a$ and $c'=5-c$ this comes to the same as finding the number of tuples $(o',a',b')$ with $o'+a'+b'=5$ under constraint:$$(o',a',b')\in\{0,1,2,3,4,5\}^3$$
But here the constraints can be weakened to:$$o',a',b'\text{ are nonnegative integers }$$
This because condition $o'+a'+b'=5$ then assures that the original constraint will be satisfied.
I leave the rest to you.

This is not more than a trick that sometimes works. Always check it out.
