|
|
@ -1,7 +1,7 @@
|
|
|
|
buckets = DATA.read.split("\n").map(&:to_i)
|
|
|
|
buckets = DATA.read.split("\n").map(&:to_i)
|
|
|
|
combos = (1..buckets.size).flat_map {|i| buckets.combination(i).select {|p| p.inject(:+) == 150 }}
|
|
|
|
puts (1..buckets.size).flat_map {|i|
|
|
|
|
min = combos.map(&:size).min
|
|
|
|
buckets.combination(i).select {|p| p.inject(:+) == 150 }
|
|
|
|
puts combos.select {|c| c.size == min }.size
|
|
|
|
}.group_by(&:size).sort_by(&:first).first.last.size
|
|
|
|
__END__
|
|
|
|
__END__
|
|
|
|
50
|
|
|
|
50
|
|
|
|
44
|
|
|
|
44
|
|
|
|