@ -6,9 +6,11 @@ input = DATA.readlines
pp input.filter_map {|val, vars|
vals = vars.inject {|n,x|
%i[ + * ].flat_map {|op|
Array(n).flat_map {[
Array(n).map { _1.send(op, x) }
_1 + x,
}
_1 * x,
"#{_1}#{x}".to_i,
]}
vals.include?(val) && val
}.sum