0

How many ways are there for a child to take 10 pieces of candy with 4 types of candy if the child takes at most 5 pieces of any type of candy?

No Name
  • 295

1 Answers1

1

146 ways.

Found programatically:

void enumerate() {
int a1, a2, a3, a4;
int count = 0;

for (a1 = 0; a1 < 6; a1++)
for (a2 = 0; a2 < 6; a2++)
for (a3 = 0; a3 < 6; a3++)
for (a4 = 0; a4 < 6; a4++)
{
    if (a1 + a2 + a3 + a4 == 10)
    {
        count ++;
    }
}
cout << count << endl;
}
Jeffrey
  • 586