Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Ghosts Age by Sim0000
def fib():
a = b = 1
while(a < 10000):
a, b = a+b, a
yield b
def checkio(opacity):
f = [x for x in fib()]
o = 10000
table = [o]
for i in range(1,5000):
if i in f:
o -= i
else:
o += 1
table.append(o)
return table.index(opacity)
# Maybe this is usaual
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio(10000) == 0, "Newborn"
assert checkio(9999) == 1, "1 year"
assert checkio(9997) == 2, "2 years"
assert checkio(9994) == 3, "3 years"
assert checkio(9995) == 4, "4 years"
assert checkio(9990) == 5, "5 years"
Feb. 24, 2014
Comments: