#P13973. [VKOSHP 2024] Nightmare Sum
[VKOSHP 2024] Nightmare Sum
题目描述
Given an array of length , consisting of distinct positive integers. Compute
$$\sum\limits_{l=1}^{n} \sum\limits_{r=l}^{n} \left\lfloor\frac{\max(a_{l},a_{l+1},\ldots,a_{r})}{\min(a_{l},a_{l+1},\ldots,a_{r})}\right\rfloor $$Here, denotes rounded down to the nearest integer.
Thus, it is necessary to compute the sum of the results of integer division of the maximum by the minimum over all subarrays of the array .
输入格式
The first line of input contains a single integer ~--- the length of the array .
The second line of input contains integers~--- the array .
It is guaranteed that all numbers in the array are distinct.
输出格式
Output a single number --- the desired sum.
6
1 3 6 4 2 5
56
提示
Let's consider the example in more detail:
:::align{center}
:::