Skip to content

Instantly share code, notes, and snippets.

@tora16e
Created February 17, 2014 07:22
Show Gist options
  • Select an option

  • Save tora16e/9046183 to your computer and use it in GitHub Desktop.

Select an option

Save tora16e/9046183 to your computer and use it in GitHub Desktop.
feed-pigeons
def checkio(number):
if number == 1:
return 1
elif number < 1000000:
L = list()
eat = number
def pigeons():
for p in range(1, number+1):
L.append(p)
yield sum(L)
pgn = pigeons()
maximum = 0
while True:
p = next(pgn)
for e in range(1,p+1):
eat = eat - 1
if maximum < e: maximum = e
if eat == 0: return maximum
@tora16e

tora16e commented Feb 17, 2014

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment