The publishing house wants to promote a set of Harry Potter books. This set of books has a total of five sets, each of which is priced at 8 yuan. If you buy one copy of any two sets, you can get off. If you buy one copy of any three sets, you can get off. If you buy one copy of any four sets, you can get off; if you buy one for each of the five sets, you will be entitled to a discount. In addition to the above discounts, the purchase of a single book is still priced at 8 yuan. For example, if you buy one of the five sets, add one of the first sets, and off for the five books, the first set is priced at 8 yuan. If someone buys 2 books in the first episode, 2 books in the second episode, 2 books in the third episode, 1 book in the fourth episode, and 1 book in the fifth episode. What is the lowest discount price after a discount? Note: Not 51.6 yuan, but 51.2 yuan.
It seems that the discount strategy is used, but here you need to calculate the lowest discount among the several combinations. You can use the responsibility chain model.
Source: http://codingdojo.org/cgi-bin/wiki.pl? Katapotter
Source code: Https://github.com/wubin28/KataPotter