我有一阵列。
现在,我想将阵列第17位的价值与阵列第1位的位置的价值区分开来,然后是第18位。 成果应当建立一个新的阵列。
然后,我想弄清新阵列的所有价值,如果两个或两个以上连续的数值大于1.2,我还要补充一下,把新阵列的最后一个价值与所有连续价值分开。 如果一个数值为1.2,下一个数值为0.8,则不应改变阵列的数值。
我的守则是:
a = [1,2,3,4,5,9,5,13,14,17,19,23,19,34,46,12,13,45,46,67,78,79]
b = Array.new
c = Array.new
a.each_cons(18) { |c| b.push(c[17]/c[0] }
Do you have an idea how to implement the condition?