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!
 A: Note your question is equivalent to the following questions:
How many different solutions for the following equation exist 
$x_{1}+x_{2}+x_{3}=10$
such that
(i)  $x_{1}$, $x_{2}$ and $x_{3}$ are non-negative integers
(ii) $x_{i} \leq 5$ for each $i=1,2,3$. holds?
Then, applying the substitution $a_{i} = 5-x_{i}$ and using the following fact should give you the answer.
$\textbf{FACT:}$ The number of different nonnegative integer solutions of $x_{1}+x_{2}+...+x_{k}=n$ is $\binom{n+k-1}{n-1}$.
I hope this helps.
A: 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.
A: You can save some time like this:
We want the coefficient of $x^{10}$ in $(1+x+x^2+x^3+x^4+x^5)^3$.
(This is 10 fruits in total from a selection  of 3, with at most 5 of each.)
Rearrange $(1+x+x^2+x^3+x^4+x^5)^3$ into:
$$\left(\frac{1-x^6}{1-x}\right)^3=\frac{1-3x^6+3x^{12}-x^{18}}{(1-x)^3}$$
We only need $x^{10}$, and also the denominator is the generating function for the triangular numbers divided by $x$, so we can immediately state:
$$[x^{10}]-3[x^4]=66-3\cdot15=21$$
A: I visualise three containers , containing $5$ oranges, $5$ apples, and $5$ bananas.
If I remove a total of $5$ fruits from them any which way, I will be left with the $10$ fruits I need, and thus $5+3-1\choose 2$ ways
