thoughts, ideas, code and other things...

Wednesday, June 11, 2008

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

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: , ,


At September 3, 2010 at 4:41 AM , Anonymous kokosek said...

Here's a link to shortening contest if anybody want:


Post a Comment

Subscribe to Post Comments [Atom]

<< Home