原题链接:Problem Sets
Cat Snuke came up with some problems. He wants to construct as many problem sets as possible using those problems. Each problem set must contain exactly three problems: one for the Easy slot, one for the Medium slot, and one for the Hard slot. Each problem can only be assigned to a single slot in a single problem set. He came up with E + EM + M + MH + H problems in total. The distribution of the problems is as follows:
- E problems can only be used in the Easy slot.
- EM problems can be used either in the Easy slot or the Medium slot.
- M problems can only be used in the Medium slot.
- MH problems can be used either in the Medium slot or the Hard slot.
- H problems can only be used in the Hard slot.
Return the maximal number of problem sets he can construct.