Yarin likes to decorate his walls with posters. Lately, he has had some trouble deciding where on the wall to put the posters so the total area of the wall that is covered with posters is maximized. The posters can of course not be cut into pieces, nor rotated, nor placed so they don't fit completely on the wall. They may overlap however (see example 0).
Create a class Posters containing the method maxCover which takes as input an int width and an int height, the width and height of the wall, and a int pWidth and a int pHeight, the width and height of each poster. Elements i in pWidth and pHeight are the width and height, respectively, of poster i. The method should return an int, the maximum area of the wall that can be covered with posters.
|Parameters:||int, int, int, int|
|Method signature:||int maxCover(int width, int height, int pWidth, int pHeight)|
|(be sure your method is public)|
|-||width will be between 1 and 100, inclusive.|
|-||height will be between 1 and 100, inclusive.|
|-||pWidth will contain between 1 and 5 elements, inclusive.|
|-||pHeight will contain between 1 and 5 elements, inclusive.|
|-||pWidth and pHeight will contain the same number of elements.|
|-||Each element in pWidth will be between 1 and width, inclusive.|
|-||Each element in pHeight will be between 1 and height, inclusive.|
The posters can be placed like this:
With only two posters, the optimal result is always reached by putting the posters in opposite corners of the wall.
|Here one poster must be surrounded by the other posters in order to get the best result.