[2017][ruby][17.x] speedrun

sorbet
Alpha Chen 7 years ago
parent 71575ca08a
commit b22b3a3481

@ -0,0 +1,21 @@
input = ARGF.read.strip.to_i
# input = 3
# buffer = [0]
pos = 0
50_000_000.times do |i|
# 10.times do |i|
pos += input + 1
# pos %= buffer.size
pos %= i + 1
p i+1 if pos.zero?
# buffer = (buffer[0..pos] << i+1).concat(buffer[pos+1..-1])
end
# index = buffer.index(0)
# p buffer[index+1]
# So 0 is always element 0...
# So we just need to know when something is inserted at element 1?
Loading…
Cancel
Save