How many ways to add to 21? Suppose there are 4 subjects, A B C and D, and each grade for a subject ranges from 0 to 10.  How many possible combinations of grades will reach a total score of 21?
 A: We assume that you know the usual Stars and Bars argument that shows that the number of ordered quadruples $(a,b,c,d)$ of non-negative integers such that $a+b+c+d=21$ is $\binom{21+4-1}{4-1}$.
Now we need to subtract the number of "bad" quadruples, where one of $a$, $b$, $c$, $d$ is $\ge 11$. Note that only one of the variables can be $\ge 11$. There are $\binom{4}{1}$ ways to choose who it will be. For the sake of the count, suppose it is D. Assign D a temporary grade of $11$. Then we must split the remaining $10$ marks between A, B, C, and D. There are $\binom{13}{3}$ ways to do this. Multiply by $\binom{4}{1}$. There are therefore $\binom{4}{1}\binom{13}{3}$ bad configurations. 
A: You can use generating functions. Each subject can be 1 to 10, which means representing it by $1 + z + \ldots + z^{10}$, there being 4 subjects the full alternatives are given by:
$$
(1 + z + \ldots + z^{10})^4
  = \frac{(1 - z^{11})^4}{(1 - z)^4}
$$
You want the coefficient of $z^{21}$:
\begin{align}
[z^{21}] \frac{(1 - z^{11})^4}{(1 - z)^4}
  &= [z^{21}] (1 - 4 z^{11} + \ldots) (1 - z)^{-4} \\
  &= [z^{21}] (1 - z)^{-4} - 4 [z^{10}] (1 - z)^{-4}
\end{align}
The rest is using the generalized binomial theorem.
