Arranging the colors on the board in the most pleasing form
Posted
by
Shashwat
on Programmers
See other posts from Programmers
or by Shashwat
Published on 2012-10-14T18:18:21Z
Indexed on
2012/10/14
21:50 UTC
Read the original article
Hit count: 218
algorithms
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.
© Programmers or respective owner