Thread: Google CodeJam?
View Single Post
  #16 (permalink)  
Old 04-23-2012, 06:17 AM
Hugh Aguilar
Guest
 
Posts: n/a
Default Re: Google CodeJam?

On Apr 21, 10:03*pm, "WJ" <w_a_x_...@yahoo.com> wrote:
> Ruby:
>
> _, numwords, numpatterns = gets().split.map{|s| s.to_i}
>
> words = (1 .. numwords).map{ gets().strip }
> patterns = (1 .. numpatterns).map{ gets().strip }
>
> patterns.each_with_index{|pat,i|
> * regex = Regexp.new( pat.gsub("(", "[").gsub(")", "]") )
> * printf "Case #%d: %d\n", i, words.grep(...
>


I don't know anything about Ruby, but I can certainly admire the
conciseness of your program. How does it compare in speed to mine?
Reply With Quote