I'm not sure what round off means.
If round off means raise anything with a decimal >= .5 the next whole number and anything with a decimal <.5 to the next whole number down, then the example will still lead to 18 pieces being assigned.
Thanks for the replies.
I don't mind so much favoring someone more than others as long as:
(ai<=wi) is not violated
we assign exactly P pieces of pizza. no more, no less
only whole slices can be assigned (no fractions for ai)
For example, if we have
w1 = 25
w2 = 9
W = 34
P = 17
Let W be the sum of all the people's weights, let P be the total number of pizza slices available.
I have P slices of pizza (P<=W)
I have n people I want to split the pizza with
I want to use people's weight to determine how many slices they get (more weight -> more slices)