Code Festival C Div and Add by ciel

def d(n)
\x09r=0
\x09(1...n).map{|i|n%i==0&&r=[r,d(i)].max}
\x09(r+=n%10;n/=10)while n>0
\x09r
end
puts $<.map{|e|d e.to_i}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page