System.in.eachLine{b=[] a=it.split()*.toInteger() a.size().times{s=v=0 a.each{b[(v+=it)+1000]=s+=' '+it} a=a[1..-1]<<a[0]} println b[-1]-~/../}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page