Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input = 793061
- recipes = [3, 7]
- elf1 = 0
- elf2 = 1
- window = 37
- l=2
- while True:
- score = recipes[elf1] + recipes[elf2]
- if score < 10:
- recipes.append(score)
- window = ((window * 10) + score) % 10000000
- l += 1
- else:
- recipes.extend(divmod(score,10))
- window = ((window * 100) + score) % 10000000
- l += 2
- elf1 = (elf1 + recipes[elf1] + 1) % l
- elf2 = (elf2 + recipes[elf2] + 1) % l
- if input == int(window/10) or input == window:
- break
- print(l-6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement