| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

PE036

Page history last edited by Kenneth Finnegan 12 years, 3 months ago

Project Euler Problem #36

 

Once I solved this problem, I was reading through the forum and realized that everyone was on crack when they were solving this.  People were converting the number into a string and converting the string.  String operations are painfully slow!!!

 

How I reversed the numbers was by pulling the first digit and putting it on a new number, then multiply the new number by 10 and divide the old, then move the next digit over, etc.  I did the same thing for binary, just with two.  This is all done in the functions rev10() and rev2().

 

Runtime: 0.056 seconds

PE036_c

 


Return to list of solutions

Comments (0)

You don't have permission to comment on this page.