Skip to main content
Tweeted twitter.com/StackMma/status/1362915002693406728
Became Hot Network Question
Language edits
Source Link
MarcoB
  • 67.7k
  • 18
  • 96
  • 198

What can I do to correctly list all possible combinations of this problem? Combinatorial selection with constraints

Question: Five of the 10 actors can only sing, two can only dance, and three can both sing and dance. Now, how many kinds of selection methods are there to perform a program that requires two people to dance and two people to sing?

Select[Map[Flatten, 
   Subsets[Table[{"sing"}, 5]~Join~Table[{"dance"}, 2]~Join~
     Table[{"sing", "dance"}, 3], {4}], {1}], 
  Count[#, "sing"] >= 2 && Count[#, "dance"] >= 2 &] // Length

The result of using the above method is 155, but the reference answer is 199(Binomial[3, 2] Binomial[3, 2] + Binomial[5, 1] Binomial[3, 1] Binomial[4, 2] + Binomial[5, 2] Binomial[5, 2]). I want to know what I

How can do toI list all the possible combinations correctly?

What can I do to correctly list all possible combinations of this problem?

Question: Five of the 10 actors can only sing, two can only dance, and three can both sing and dance. Now, how many kinds of selection methods are there to perform a program that requires two people to dance and two people to sing?

Select[Map[Flatten, 
   Subsets[Table[{"sing"}, 5]~Join~Table[{"dance"}, 2]~Join~
     Table[{"sing", "dance"}, 3], {4}], {1}], 
  Count[#, "sing"] >= 2 && Count[#, "dance"] >= 2 &] // Length

The result of using the above method is 155, but the reference answer is 199(Binomial[3, 2] Binomial[3, 2] + Binomial[5, 1] Binomial[3, 1] Binomial[4, 2] + Binomial[5, 2] Binomial[5, 2]). I want to know what I can do to list all the possible combinations correctly?

Combinatorial selection with constraints

Five of the 10 actors can only sing, two can only dance, and three can both sing and dance. Now, how many kinds of selection methods are there to perform a program that requires two people to dance and two people to sing?

Select[Map[Flatten, 
   Subsets[Table[{"sing"}, 5]~Join~Table[{"dance"}, 2]~Join~
     Table[{"sing", "dance"}, 3], {4}], {1}], 
  Count[#, "sing"] >= 2 && Count[#, "dance"] >= 2 &] // Length

The result of using the above method is 155, but the reference answer is 199(Binomial[3, 2] Binomial[3, 2] + Binomial[5, 1] Binomial[3, 1] Binomial[4, 2] + Binomial[5, 2] Binomial[5, 2]).

How can I list all the possible combinations correctly?

Source Link

What can I do to correctly list all possible combinations of this problem?

Question: Five of the 10 actors can only sing, two can only dance, and three can both sing and dance. Now, how many kinds of selection methods are there to perform a program that requires two people to dance and two people to sing?

Select[Map[Flatten, 
   Subsets[Table[{"sing"}, 5]~Join~Table[{"dance"}, 2]~Join~
     Table[{"sing", "dance"}, 3], {4}], {1}], 
  Count[#, "sing"] >= 2 && Count[#, "dance"] >= 2 &] // Length

The result of using the above method is 155, but the reference answer is 199(Binomial[3, 2] Binomial[3, 2] + Binomial[5, 1] Binomial[3, 1] Binomial[4, 2] + Binomial[5, 2] Binomial[5, 2]). I want to know what I can do to list all the possible combinations correctly?