Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Oil Pie by Moff
from fractions import Fraction
def divide_pie(robots):
n = sum(map(abs, robots))
pie = Fraction(1)
for g in robots:
pie -= pie * Fraction(-g, n) if g < 0 else Fraction(g, n)
return pie.numerator, pie.denominator
Aug. 5, 2015