Small Change by shinh

#!ruby -pla
s,*m=$F.map &:to_i
d={}
*q=[s,a=[]]
s>0&&m.map{|v|d[z=s-v]||=q<<[z,a+[v]]}while(s,a=q.shift)&&s!=0&&s
$_=s ?a*' ':'-'

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

download

return to the top page