| ||You are playing a game where you have numRed red boxes, numBlue blue boxes,
numRed red balls, and numBlue blue balls. |
You must place a single ball into each box.
Each box is then scored as follows:
Your total score is the sum of the scores of all the boxes.
- If the box is red and it contains a red ball, you get onlyRed points.
- If the box is blue and it contains a blue ball, you get onlyBlue points.
- In all other cases, you get bothColors points.
Return the maximum possible total score you can get.
|Parameters:||int, int, int, int, int|
|Method signature:||int getMaximum(int numRed, int numBlue, int onlyRed, int onlyBlue, int bothColors)|
|(be sure your method is public)|
|-||numRed and numBlue will each be between 1 and 100, inclusive. |
|-||onlyRed, onlyBlue, and bothColors will each be between -1000 and 1000, inclusive. |
In this example, you should put two red balls into red boxes, and three blue balls into blue boxes.
Then you can get 100 * 2 + 400 * 3 = 1400 points in total.
bothColors is a larger value here than it was in the previous example.
You should put two blue balls into red boxes, and two red balls and one blue ball into blue boxes.
Then you can get 300 * 4 + 400 * 1 = 1600 points.
|No matter how you place the balls, your score will always be the same.
|The maximum total score may be less than zero.