PackingBallsDiv2
SRM 609 · 2013-12-22 · by semiexp
Problem Statement
Constraints
- R, G, and B will each be between 1 and 100, inclusive.
Statement by TopCoder, Inc. — view the original on the archive.
4 2 4 Returns: 4
We have 4 red, 2 green, and 4 blue balls. Clearly, we need at least four packages to store 10 balls. One possibility of using exactly four packages looks as follows: RGB, RG, RR, BBB. (I.e., the first package has 1 ball of each color, the second package has a red and a green ball, and so on.)
1 7 1 Returns: 3
Here the only possible solution is to have one package with RGB and two packages with GGG each.
2 3 5 Returns: 4
78 53 64 Returns: 66
100 100 100 Returns: 100
Submissions are judged against all 133 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class PackingBallsDiv2 with a public method int minPacks(int R, int G, int B) · 133 test cases · 2 s / 256 MB per case