Card distribution with constraints
问题 Suppose I would like to distribute a deck of 52 cards unto N players , not necessarily equally so each player Pi would get a number of cards Ci . Suppose that each of these players might have constraints that dictate what cards (s)he can receive, for example Player P2 cannot get any cards in the Hearts color and P5 cannot get any cards above 10. All these constraints are guaranteed to have at least one distribution/solution. My main question is how would one go about this programmatically?