Greedy Florist

  • + 4 comments

    A purchases (1)100 + (2)7 + (3)1 = 100 + 14 + 3 = 117

    B purchases (1)9 + (2)2 = 9 + 4 = 13

    P(A) + P(B) = 130 (this is one possible distribution)

    Remember that we have two people, so we can repeat coefficients up to two times each. We can therefore construct any permutation of the list [1,1,2,2,3] to multiply elementwise with the prices. It's simply a matter of choosing the most advantageous order to purchase.