Dinesman's multiple-dwelling problem: Difference between revisions

m
Line 3,082:
b,c,f,m,s = N
 
N.permutation.map(&:{|a| a.join) " "}.
grep(/(?=.*#{b}.)
(?=.+#{c})
(?=.+#{f}.)
(?=.*#{c}.*#{m})
(?=.*(#{f}..+#{s}|#{s}..+#{f}))
(?=.*(#{f}..+#{c}|#{c}..+#{f}))/x).
first
first.gsub(/(?=[A-Z])/," ").strip
</lang>
<pre>
Anonymous user