Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Cardano solution in Clear category for Feed Pigeons by gyahun_dash
def checkio(food):
root = (9 * food ** 2 - 1 / 27) ** (1 / 2)
time = int(sum((3 * food + s * root) ** (1 / 3) for s in (1, -1))) - 1
pigeons = time * (time + 1) // 2
eaten = time * (time + 1) * (time + 2) // 6
return max(pigeons, food - eaten)
Feb. 28, 2016
Comments: