IdeaMonk

thoughts, ideas, code and other things...

Monday, June 09, 2008

KAMIL ... stuck at 57

Another challenge problem at SPOJ - KAMIL
interesting one, easy to figure out, but what the heck, write shortest code!
with C i could get 127 bytes code :(
Come Ruby into picture and poof! we got 57!

10.times do
s=gets
p=1
s.gsub(/[DTFL]/){p*=2}
puts p
end

looking forward for more compression... ;)

Labels: , ,

1 Comments:

At October 2, 2012 at 2:21 PM , Blogger Indian said...

loop{p 2**(gets||exit).count('TDLF')} - Saptarshi Chatterjee (@c)

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home