It seems that these kinds of problems can be solved with something similar linear programming? at least for the Div2 A problem all we had to do was identify the constraints and output the minimum of them. Does anyone know exactly what topic these problems come under and how to find more like them?
Here's the statement for those who don't want to click the link:
Shash has g gold, s silver and b bronze medals. He wants pictures of himself in these medals. After each picture, he discards the medals he wore and cannot use them again. In each picture, he wears 3 medals. All 3 should not be of the same type. He wants to know the maximum number of photos p that he can get.
g, s and b in that order.
The maximum number of photos p, that Shash can click.
5 4 3
Explanation: "gss", "sbb", "bgg", "ggs".
Would appreciate if anyone can give ideas on how to solve specifically this problem and problems similar to it.