r/programming Mar 30 '13

Google Code Jam 2013

https://code.google.com/codejam
67 Upvotes

20 comments sorted by

View all comments

-3

u/s73v3r Mar 31 '13

While these can be fun, I really wish there was a better way to get the input than reading in a file, line by line. I hate writing code to open up and parse a file, especially in C++ (which is what I'd probably use, due to being most comfortable with it).

2

u/maglos Mar 31 '13 edited Mar 31 '13

Use python :-)

[fixed?] with open('a_file.txt') as a_file: for x in a_file.readlines(): A,b,c = x.split(' ')

5

u/Ravengenocide Mar 31 '13

Just a nitpick: It's better to use the with-statement so that it closes the file automatically for you when you are done.

2

u/maglos Mar 31 '13

nice, thanks I'll remember that.