mirror of
https://github.com/onyx-and-iris/aoc2025.git
synced 2025-12-08 11:47:47 +00:00
upd
This commit is contained in:
parent
65934bcaa0
commit
c0152a39b2
@ -13,7 +13,7 @@ class Main
|
|||||||
when "R"
|
when "R"
|
||||||
current = (current + magnitude) % 100
|
current = (current + magnitude) % 100
|
||||||
when "L"
|
when "L"
|
||||||
current = (current -= magnitude) % 100
|
current = (current - magnitude) % 100
|
||||||
end
|
end
|
||||||
|
|
||||||
if current == 0
|
if current == 0
|
||||||
|
|||||||
@ -9,7 +9,7 @@ class Main
|
|||||||
$stdin.each_line do |line|
|
$stdin.each_line do |line|
|
||||||
direction, magnitude = line[0], line[1..].to_i
|
direction, magnitude = line[0], line[1..].to_i
|
||||||
|
|
||||||
while magnitude > 0
|
magnitude.times do
|
||||||
case direction
|
case direction
|
||||||
when "R"
|
when "R"
|
||||||
current = (current + 1) % 100
|
current = (current + 1) % 100
|
||||||
@ -20,8 +20,6 @@ class Main
|
|||||||
if current == 0
|
if current == 0
|
||||||
count += 1
|
count += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
magnitude -= 1
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user