Distribution of beans in jars to k members
If this is a practical problem, it can be solved using integer linear programming (ILP).

We'll introduce three kinds of integer variables:


$x_{i,j}$ counts the number of beans from jar $i$ that are given to child $j$.
$y_{i,j}$ is 1 if child $j$ gets any beans from jar $i$, or 0 otherwise.
$z_i$ is the number of children who get at least one bean from jar $i$.


Then we'll add some constraints to enforce the requirements in the question:


$\lfloor B/C \rfloor \le \sum_i x_{i,j} \le  \lceil B/C \rceil$ where $B$ is the total number of beans across all the jars.  This ensures that each child receives the same number of beans.
$0 \le x_{i,j} \le B_i y_{i,j}$, where $B_i$ is the number of beans in jar $i$, and $0 \le y_{i,j} \le x_{i,j}$.  This ensures that $x_{i,j}$ and $y_{i,j}$ are consistent with each other.
$\sum_j x_{i,j} \le B_i$.  This ensures that you don't give out more beans from jar $i$ than are available.
$z_i = \sum_j y_{i,j}$.


Finally, the objective function is the average of the $z_i$'s, i.e., $\frac{1}{N} \sum_i z_i$.  We feed this to an integer linear programming solver and ask it to minimize the objective function, subject to the constraints above.

The worst-case running time of ILP solvers is exponential time, but in practice they are sometimes much more efficient than you might think.  If you have $N,C &lt; 50$, I suspect this might be efficient enough to work in practice.  The only way to find out for sure is to try it.