pull/1/head
Alpha Chen 2 years ago
parent 049eedabf4
commit e1016ab913
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -0,0 +1,14 @@
p ARGF.read.strip.lines(chomp: true).map(&:split).map {|a,b|
a = a.ord - ?A.ord
b = b.ord - ?X.ord
# part 2
b = (a + b - 1) % 3
outcome = case
when (a + 1) % 3 == b then 6
when a == b then 3
else 0
end
outcome + b + 1
}.sum
Loading…
Cancel
Save