, index1 = banks.each_with_index.max{ a[0] <=> b[0] }
inc1 = fullest / banks.length
inc2 = inc1 + 1
ex = fullest % banks.length - 1
banks.each_with_index.map do
inc = if (index - index1 - 1) % banks.length <= ex
inc2
else
inc1
end
c = if index == index1
0
else
s
end
inc + c
end
end
Enumerator.new do
cache = {}
while !cache.key? banks
cache[banks] = true
y.yield banks
banks = redist banks
end
end
end
initial_state = Enumerator.new do
File.open(ARGV[0],"r") do
src.each_line do
line.split(/\s/).each do
num = word.to_i
y.yield num if num
end
end
end
end.to_a
puts until_cycle(initial_state).count
fullest