430 傳統題

[ABC356E] 全对商之和 (Max/Min)

时间限制
2000ms
内存限制
1024MiB
登顶 / 尝试
1/ 1
難度
4
    上傳者 標籤AtCoderABC356提高-调和级数值域前缀和

[ABC356E] 全对商之和 (Max/Min)

Score : 475 points Problem Statement You are given a sequence A=(A_1,\ldots,A_N) of length N. Find \displaystyle \sum_{i=1}^{N-1}\sum_{j=i+1}^{N}\left\lfloor\frac{\max(A_i,A_j)}{\min(A_i,A_j)}\right\rfloor. Here, \lfloor x \rfloor represents the greatest integer not greater than x. For example, \lfloor 3.14 \rfloor=3 and \lfloor 2 \rfloor=2. Constraints 2 \leq N \leq 2\times 10^5 1 \leq A_i \leq 10^6 All input values are integers. Input The input is given from Standard Input in the following format: N A_1 \ldots A_N Output Print the answer.