-
Losing my marbles
There are 10 red marbles, 20 blue marbles, and 30 green marbles. 10 people, in turn, choose one marble. Each person can choose a total of 1 red, 2 blue, 3 green. Each chosen marble is placed in a continous row to create a row of all 60 marbles. How many different rows can be created? Can you write a program that would print out each different row? For example:
rrrrrrrrrrbbbbbbbbbbbbbbbbbbbbgggggggggggggggggggggggggggggg
rrrrrrrrrrbbbbbbbbbbbbbbbbbbbgbggggggggggggggggggggggggggggg
rrrrrrrrrrbbbbbbbbbbbbbbbbbbbggbgggggggggggggggggggggggggggg
-
Not sure if i understand this correctly, but isn't it just permutations of the string, "rrrrrrrrrrbbbbbbbbbbbbbbbbbbbbgggggggggggggggggggggggggggggg"
(with duplicates removed)? Or is not producing the duplicates in the first place the point of the problem?
-
Yep. Permutations. No duplicates. Preferably no duplicates to begin with. I think it is 60^10.
-
I don't think your outputted strings match the rules of the problem. They obviously don't follow "1 red, 2 blue, 3 green"
In fact, it looks like you just have subgroups within a group.
Basically, you have 10 groups of 6 marbles. Each group of marbles can be X different permutations.
X^10 is the answer.
The red marble is going to multiply the final by 6...
So how many greens can I do...4+3+2+1 = (4+1)/2*4 = 2.5*4 = 10
10*6 = 60
60^10 = answer