(Hopefully it's still Thanksgiving for you)
You got a turkey for your thanksgiving dinner but you don't know how to evenly distribute it. The problem is, some people eat more than others, so you need to find a solution
There will be two inputs. The first will be an ascii art of various people.
o o \|/ \|/ | | | / \ / \
Each person takes up a width of 3 columns. Each person is separated by a single column of spaces. The very top of each person is an
o. Below the
o, offset by
-1 in the x, are
/, respectively. From the
o to the second to last row in the input are
|, the amount of these per person is their "height". The only data you will need to extract from each person is their "height".
There will always be at least one person. Each person always has at least 2-height. The max height your program should handle is at least a height of 64.
If you would like the input padded with spaces to form a rectangle, please specify this in your answer.
The second input is the turkey. The turkey is not really a turkey, more of
NxM dimensions of a turkey. If the second input is
3x2, then the turkey has dimensions of 3*2, with a total area of 6.
The output may be a list or your language's closest alternative (e.g. Array). You may also output a string, with the values separated by spaces.
The values for each person should be output in the order in which they were input.
Your goal is to divide the area of the turkey among the people.
An example scenario:
Assume they are two people, with heights of
6, respectively. If there is a turkey of
5x3. The total area of the turkey that will need to be distributed is
Now how would you distribute it among everyone? Here's how:
the_persons_height TurkeyForAPerson = -------------------- * turkey_area sum_of_all_heights
This means, for the first person with a height of
3, they will get
3/9*15 turkey, or
5, the second person with a height of
6 they will get
Output must solely consist of digits, and
., unless you choose to go for the bonus. In that case, it may only consist of digits, spaces (
), and a slash (
6x5 o | o \|/ \|/ | | | | | / \ / \
-20% Bonus: You output a fraction (must be simplified), it does not matter whether it is a mixed or improper fraction.
This is code-golf so shortest code in bytes wins!