Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Toadally clear solution in Clear category for Ghosts Age by Faibbus
def checkio(tip):
MAGIC = (lambda x:x[0]+x[3]*x[4])(list(map(ord,"mAGIC")))
MORE = (lambda x:x[4]-x[1])(list(map(ord,"mAGIC")))
spells = [True]+[False]*(MAGIC)
this, that = 0,1
while that <=MAGIC:
spells[that] = True
this,that = that, this+that
cut_fingers=[MORE*MAGIC]
for toad in range(MORE//MORE,MAGIC + MORE//MORE):
cut_fingers = cut_fingers + [cut_fingers[-1] + (-toad if spells[toad] else MORE//MORE)]
return cut_fingers.index(tip)
March 3, 2014
Comments: