Selective Amnesia
This is not an easy problem. I gave up on this problem for a couple of times. Finally, I made all my effort to simplify this problem, it is solved!
The first part is to transform the pairs of numbers into states, which is quite complicated. I spent half a day or even longer on this part. After this part is done, the task left is just to solve a very easy probability problem. Quite a few problems in Project Euler require such sort of abstraction. For example, problem 324, building a tower.
It takes my code 0.17s to find the answer. It looks like there is still some potential to speed up.
After this problem is solved. I entered level 14. Still another 25 problems left to enter level 15.
No comments:
Post a Comment