22/09/09 23:02:00.41 Un8DgV3E.net
>>751
a = [17, 3, 3, 1, 6, 13, 11, 17, 2, 5, 7, 18, 16, 5, 8, 6, 5, 1, 11, 1]
b = [390, 240, 37, 396, 198, 99, 242, 53, 329, 202]
c = a.group_by(&:itself).values.map{_1.size > 2 ? _1[0, 2] : _1}.flatten.permutation(2).map{[_1 * _2, [_1, _2].sort]}.uniq.sort.to_h
b.each{|s| puts '%d: %s' % [s, c.find{_1[0] >= s}&.[](1)&.join(?,) || :error]}
# =>
390: error
240: 16,17
37: 3,13
396: error
198: 11,18
99: 6,17
242: 16,17
53: 3,18
329: error
202: 13,16