Arranging the colors on the board in the most pleasing form
- by Shashwat
Given a rectangular board of height H and width W. N colors are given. ith color occupy Pi percentage of area on the board. Sum of Pis is 1.
What can be algorithm to layout the colors on the board in the form of rectangles in the most pleasing form. By pleasing mean the aspect ratios (Width/Height) of rectangle of each color should be as close to 1 as possible. In an ideal case the board would be filled only with squares.