1
0
Fork 0
advent-of-code-2024/03/3-1.rb

11 lines
195 B
Ruby
Executable file

#!/usr/bin/env ruby
problem = 3
input = File.readlines("#{problem}.input").join
result = input
.scan(/mul\((\d{1,3}),(\d{1,3})\)/)
.map { _1.map(&:to_i).inject(1, :*) }
.sum
puts result