Small Change by kinaba

#!ruby -pla
e,*c=$F.map &:to_i
*q=0
*a=[]
q.map{|b|b<e&&c.map{|v|a[u=b+v]||=q<<u&&a[b]+[v]}}
$_=(a[e]||[:-])*" "

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

download

return top