Problem Statement : Click here.
asked 30 Jun '15, 18:29

Your formula will lead to repeated cases. Example there are 4 boys and 3 girls and t = 6 then your answer is c[4][4] * c[3][1] * c[2][1] = 6 but answer is 3 because there are only 4 boys so each group needs to have all the boys plus 2 more girls for which there are C[3][2] ways = 3. What is happening is that once you fix certain girls/boys in the compulsory slot call them X and then you pick another set of boys/girls in the non compulsory slot, call them Y. Now it is possible that in some other group, you have already counted this group by including some of Y in the compulsory slots and some of X in the non compulsory slot. Since t is small, I would suggest you go by the answer as  Depending on n and m, there will be slight modifications in this, but you get the idea. answered 30 Jun '15, 19:23

I think c[n][4]*c[m][1] is enough. answered 30 Jun '15, 19:13
