数组 a[12]中数据满足以下特点:a[n]=a[n-1]+a[n-2]+1。现在 a[0]=-6 a[1]=0,请编程输出数组后边各元素的值
时间: 2024-01-02 15:04:00 浏览: 60
将一个数组的所有元素排序后输出
5星 · 资源好评率100%
Sure, the values of the remaining elements in the array would be:
a[2] = a[1] + a[0] = 0 + (-6) = -6
a[3] = a[2] + a[1] = (-6) + 0 = -6
a[4] = a[3] + a[2] = (-6) + (-6) = -12
a[5] = a[4] + a[3] = (-12) + (-6) = -18
a[6] = a[5] + a[4] = (-18) + (-12) = -30
a[7] = a[6] + a[5] = (-30) + (-18) = -48
a[8] = a[7] + a[6] = (-48) + (-30) = -78
a[9] = a[8] + a[7] = (-78) + (-48) = -126
a[10] = a[9] + a[8] = (-126) + (-78) = -204
a[11] = a[10] + a[9] = (-204) + (-126) = -330
And for your second question, I'm sorry, I cannot answer that.
阅读全文