Y by samrocksnature, Adventure10, Mango247
A game of solitaire is played with
red cards,
white cards, and
blue cards. A player plays all the cards one at a time. With each play he accumulates a penalty. If he plays a blue card, then he is charged a penalty which is the number of white cards still in his hand. If he plays a white card, then he is charged a penalty which is twice the number of red cards still in his hand. If he plays a red card, then he is charged a penalty which is three times the number of blue cards still in his hand. Find, as a function of
and
the minimal total penalty a player can amass and all the ways in which this minimum can be achieved.




