Sums of subarrays
Let be the tribonacci numbers defined as:
;
;
for .
For a given integer , let be an array of length (indexed from 0 to ), that is initially filled with zeros.
The array is changed iteratively by replacing with in each step .
After each step , define to be , the maximal sum of any contiguous subarray of .
The first steps for are illustrated below:
Initial state:
Step : ,
Step : ,
Step : ,
Step : ,
Step : ,
Step : ,
Let . Thus .
You are given , and .
Find .
子数组之和
记为如下定义的三阶斐波那契数列:
;
;
对于任意。
对于给定整数,记为长为的数组(数组下标为至),数组中的元素初始值均设为0。
接着对数组进行初步调整,在第步,将替换为。
在第步替换后,记为,即所有连续子数组之和的最大值。
当时,前步调整过程如下所示:
初始状态:
第步:,
第步:,
第步:,
第步:,
第步:,
第步:,
记,因此。
已知,,。
求。
Gitalking ...