Graph by yvl

#!ruby -na
eval"B=%d
A=*0...%d"%$F
g=A.map{gets.split}
puts (A-[0]).map{|i|c=0
o=proc{|f,r|r>0&&A.map{|t|x=g[f][t].to_i
r==x&&t==i ?c+=1:x>0&&o[t,r-x]}}
o[0,B]
c}*" "

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

download

return top