📅  最后修改于: 2022-03-11 15:04:47.505000             🧑  作者: Mango
left,right = a.each_slice( (a.size/2.0).round ).to_a
# Example
a = [1,2,3,4,5] # => [1, 2, 3, 4, 5]
a.each_slice( (a.size/2.0).round ).to_a # => [[1, 2, 3], [4, 5]]