Function

2020 VietMX 0

Serega and Fedor play with functions. One day they came across a very interesting function. It looks like that: f(1, j) = a[j], 1 ≤ j ≤ n. f(i, j) = min(f(i - 1, j), f(i - 1, j - 1)) + a[j], 2 ≤ i ≤ n, i ≤ j ≤ n. Here a is an integer array […]