remove loop

This commit is contained in:
onyx-and-iris 2025-12-01 18:27:25 +00:00
parent f073b70176
commit 91c0cfa768

View File

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
class Main
def run
@ -8,12 +9,12 @@ class Main
$stdin.each_line do |line|
direction, magnitude = line[0], line[1..].to_i
loop do
while magnitude > 0
case direction
when "R"
current = (current + 1) % 100
when "L"
current = (current - 1) % 100
current = (current - 1 + 100) % 100
end
if current == 0
@ -21,7 +22,6 @@ class Main
end
magnitude -= 1
break if magnitude == 0
end
end