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: programming contest, Ruby, SPOJ
1 Comments:
loop{p 2**(gets||exit).count('TDLF')} - Saptarshi Chatterjee (@c)
Post a Comment
Subscribe to Post Comments [Atom]
<< Home