[2024][ruby][3.x]

main
Alpha Chen 1 week ago
parent 85d7e21ad7
commit 54c626efc3
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -0,0 +1,9 @@
input = DATA.read
.gsub(/don't\(\)(?~do\(\))do\(\)/, "") # part two
.scan(/mul\((\d+),(\d+)\)/)
.map { _1.map(&:to_i) }
pp input.sum { _1 * _2 }
__END__
xmul(2,4)&mul[3,7]!^don't()_mul(5,5)+mul(32,64](mul(11,8)undo()?mul(8,5))
Loading…
Cancel
Save