Maximum Cyclic Segment Sum by hallvabo

while 1:
 a=m=map(int,raw_input().split());i=0
 for _ in a:
\x09i+=1;l=(a+a)[i:i+len(a)]
\x09while l:m=(m,l[:])[sum(l)>sum(m)];l.pop()
 print' '.join(map(str,m))

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

download

return to the top page