This commit is contained in:
2025-12-01 08:34:02 -08:00
parent 517dede130
commit 064dc676cd
5 changed files with 4066 additions and 1 deletions

25
2025/01.rb Normal file
View File

@@ -0,0 +1,25 @@
input = File.readlines('input/01')
pos = 50
p1 = 0
p2 = 0
input.each do |line|
dir = line[0]
n = line[1..].to_i
(1..n).each do
if dir == 'R'
pos = (pos - 1 + 100) % 100
else
pos = (pos + 1) % 100
end
if pos.zero?
p2 += 1
end
end
if pos.zero?
p1 += 1
end
end
puts p1
puts p2