Ok, here's the result of mine:
mark@server1:~/rubyquiz/139$ time ./ip2country.rb 195.135.211.255
UK
real 0m0.004s
user 0m0.004s
sys 0m0.000s
Here's my code:
#!/usr/bin/ruby
ARGV.each { |ip|
f = ip.split(/\./).join "/"
puts File.open(f).readlines[0] rescue puts "Unknown"
}
I think it's pretty obvious what the preparation step was. Of course,
the tradeoff for this speed is a MASSIVE waste of disk resources, but
that was unlimited in this contest, was it not? :-)
- Mark.