Wednesday, April 10, 2013

project euler problem 104

Pandigital Fibonacci ends

I reviewed my old code today, it is ugly. I kept all digits in a vector, which finally contains a n X 10,000 of digits, where most of them are useless. This time, I only kept the last 9 digits. 

I compared my old code with my new code. 
Old code: 20 seconds;
New code:  0.144 second;

The difference is huge!


There is another problem which is quite similar to this problem but much more difficult to solve. Problem 399

No comments:

Post a Comment