Combinatorial distribution Need some help with this exercise:
There are $300$ students in a course. Each student can get a grade from $0-100$.
How many ways can you divide the scores to get an average of $60$?
I had struggles to isolate the scenario of the exact required average.
After that I know how to make the distribution. 
 A: First of all note that average of 60 implies a total score (sum of score of all students) $= 60\cdot300=18000$.
Also, let $x_i$ be the score of $i^{th}$ student. Then, $0\leq x_i\leq100$. I assume that you can only can integral grades. 
Note that what you need is $x_1+x_2+\cdots+x_{300}=18000$
So, using generating functions, total possible ways$=$
$$\text{Coeff. of }z^{18000}\text{ in }(z^0+z^1+z^2+\cdots+z^{100})^{300}$$
$$=(\frac{z^{101}-1}{z-1})^{300}$$
$$=(z^{101}-1)^{300}\cdot(z-1)^{-300}$$
$$=\sum_{i=0}^{178}\binom{300}{i}\binom{300+(18000-101i)-1}{18000-101i}$$
$$=\sum_{i=0}^{178}\binom{300}{i}\binom{18299-101i}{18000-101i}$$
Note that I took $i\leq 178$ because $18000-101i\geq0\implies i\leq178.2$. And I'll be really honest. I don't know if there's any way to solve that summation.
A: Suppose there are $n$ students in a given course, and on a particular exam each student can receive an integer grade from $0$ to $100$. If the class average on the exam is exactly $60$, then how many different grade distributions are there for the students in the course?
What we are really doing is counting the solutions to a restricted Diophantine equation:
$$
s_1+s_2+\cdots+s_n=n\cdot60 \quad \text{with all } s_i\in[0,100]
$$
In the case $n=1$, there is clearly only one solution. In the case $n=2$, we will have $81$ solutions, and for $n\geq 3$ it becomes clear that there are difficult counting problems involved that yield some rather large numbers.
Thankfully, this problem has been well studied; what we are really doing is counting lattice points in some high dimensional polytope, which can be accomplished with Ehrhart polynomials. In particular, this post has an answer that demonstrates how you may go about computing the answer you seek!
