Maximum Cyclic Segment Sum by mokos

#!ruby -ap
a=$F*2
n=$F.size
m=0
n.times{|i|1.upto(n){|j|w=eval a[i,j]*'+'
m,$_=w,a[i,j]*' '+$/if w>m}}

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

download

return to the top page