Tuesday, June 4, 2013

project euler problem 208

Robot Walks

This problem is very interesting, and also very difficult. I like it. When I first tried to solve it, I have no clue.  It take me several days to find out what I am supposed to do. I even used the pentaflake figure from mathworld to test some of my idea. Finally, I found the problem was simpler than I thought. The clarification of problem 208 is very useful. One may get a lot of hint from the discussion. 

I first used quite complicated struct to solve this problem. It takes more than five seconds. After I simplified the struct to two integers, it is solved in less than 3 second. 

Today,  I reviewed the discussion. I found that I can use some symmetry properties to reduce the search space. Then it takes only less than 0.5 second to solve the problem. 


No comments:

Post a Comment