System.in.eachLine{(n,a)=it.split() z=a as List a.each{i=0;z=(s=z.sort()).sum{[a[i++]+it]}} println s[n as Byte]}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page