Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Oil Pie by UFO665
from fractions import Fraction
def divide_pie(groups):
iRobots = sum(abs(n) for n in groups)
fr = Fraction(1, 1)
for n in groups:
fr -= Fraction(n, iRobots) if n > 0 else fr * abs(n) / iRobots
return fr.numerator, fr.denominator
Feb. 10, 2016