• 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.



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

Project Euler Problem #11


The hardest part of this problem, by far, was formatting the huge list of numbers so it would be useable in the program.  I originally tried scanning it in as a string, but it was giving me problems (I hate strings), so I decided to convert them straight into an array using some vim-foo.


1) copy paste 20 lines of numbers into vim.

2) add { } to the beginning and end.

3) In command mode "19J", which moves the next 19 lines onto this on, to make one line of numbers.

4) ":s/ /,/g" substitute commas for all the spaces

5) ":s/,0/,/g" removes any of the numbers that happen to be lead by a 0, since they look like they're in octal.


From there, I resorted the one long array into a [20][20] array, which I did all the work on, which was pretty trivial.





Return to list of solutions

Comments (0)

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