You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
buckets = DATA.read.split("\n").map(&:to_i)
|
|
puts (1..buckets.size).map {|i| buckets.combination(i).select {|p| p.inject(:+) == 150 }.size }.inject(:+)
|
|
__END__
|
|
50
|
|
44
|
|
11
|
|
49
|
|
42
|
|
46
|
|
18
|
|
32
|
|
26
|
|
40
|
|
21
|
|
7
|
|
18
|
|
43
|
|
10
|
|
47
|
|
36
|
|
24
|
|
22
|
|
40
|