2008-09-20 そして 端の二行を与えて解を数える。 def nq2(size, r1, r2) board = concat([r1], r2) return 0 unless board nq(size, board) end def ipsj(size) found = 0 size.times do |r1| size.times do |r2| found += nq2(size, r1, r2) end end found end