Ways to distribute candies using inclusion/exclusion

263 Views Asked by At

I have 173 million pieces of candy. There are 5 students. In how many ways can this distribution be made, assuming that each student receives at least 1 million candies, Student B receives at most 10 million candies, and Student C receives at most 30 million candies, and Student D is to receive at least 5 million candies?

I can do this with a generating function, but have no idea how to approach this with inclusion and exclusion.

1

There are 1 best solutions below

8
On BEST ANSWER

Give one million candies to $A,B,C,E$ and five million to $D$ (We have to do it anyways so lets get it out of the way). We now have $164$ million and the only requirements are that $B$ gets at most $9$ million and $C$ gets at most $29$ million.

There are $\binom{164,000,004}{4}$ ways to distribute the coins ignoring the upper limit to the candy for $B$ and $C$ because of stars and bars.

Now use inclusion exclusion: How many ways are there in which $B$ gets more than $9$ million(Call this $b$). How many ways are there in which $C$ gets more than $9$ million (Call this $c$), how many ways are there in which $B$ gets more than $9$ million and $C$ more than $29$ million(call this $m$)?

You can solve each of these problems via stars and bars.

at the end your solution will be

$\binom{164,000,004}{4}-b-c+m$ by inclusion exclusion.