Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
5-liner: oil solution in Clear category for Oil Pie by przemyslaw.daniel
def divide_pie(drones):
a, b, n = 1, 1, sum([abs(x) for x in drones])
for i in drones:
a, b = a*(i+n) if i < 0 else n*a-i*b, b*n
return [x//__import__('fractions').gcd(a, b) for x in (a, b)]
Feb. 8, 2017