Maximum Cyclic Segment Sum by nn

m=i=n=NF{for(;i-->j=0;$0=s)for(s=v=$n;++j<n;v+=$j)s=(a[v>m&&m=v]=s)FS$j}$0=a[1]

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

download

return to the top page