Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Ghosts Age by plutasnyy
w=25
ciag=[]
for i in range(w):
if (i==0 or i==1 or i==2):
ciag.append(1)
else:
ciag.append(ciag[i-1]+ciag[i-2])
def znajdz(zmienna):
for i in ciag:
if zmienna==i:
return 1
return 0
def checkio(opacity):
widocznosc=10000
tab_lat=[]
wiek=0
while widocznosc != opacity:
wiek+=1
if (znajdz(wiek))==True:
widocznosc-=wiek
else :
widocznosc+=1
return wiek
#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"
Oct. 21, 2016