Today is my lucky day!
if you are trying KAMIL problem with Ruby, go and read Variety in output...
# print is 'low level', puts
# puts adds a \n if needed
# p dumps a variable - so quotes it
so why not use 'p' instead of that puts
and we now jump to 43 bytes of code
10.times{q=1
gets.gsub(/[DTFL]/){q*=2}
p q}
I love ruby, I envy perl(best solution is of 6 bytes in perl)
people say its so because of weakness of the judge... who knows !
Bingo! SIZECON becomes 44 bytes now!
checkout change in s+=b>0?b:0
s=0;gets.to_i.times{b=gets.to_i;s+=b if b>0}
p s
Labels: programming contest, Ruby, SPOJ
1 Comments:
Here's a link to shortening contest if anybody want:
http://www.spoj.pl/SHORTEN/
Post a Comment
Subscribe to Post Comments [Atom]
<< Home