Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Oil Pie by flpo
from fractions import Fraction
def divide_pie(drone_groups):
n_drones = sum(map(abs, drone_groups))
pie = Fraction(1)
for drones in drone_groups:
pie -= Fraction(abs(drones), n_drones) * (1 if drones > 0 else pie)
return pie.numerator, pie.denominator
July 17, 2017
Comments: