当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6303:Period Sequence

题目描述
Chiaki has $n$ integers $s_0,s_1,\dots,s_{n-1}$. She has defined an infinite sequence $S$ in the following way: $S_k = s_{k \bmod n} + n \cdot \lfloor \frac{k}{n} \rfloor$, where $k$ is a zero based index.

For a continuous subsequence $S[l..r]$, let $cnt_x$ be the number of occurrence of $x$ in the subsequence $S[l..r]$. Then the value of $S[l..r]$ is defined as follows $$f(l,r)=\sum\limits_{x}x \cdot cnt^2_x$$

For two integers $a$ and $b$ ($a \le b$), Chiaki would like to find the value of $$(\sum\limits_{a \le l \le r \le b} f(l,r)) \bmod (10^9+7)$$
输入解释
There are multiple test cases. The first line of input contains an integer $T$, indicating the number of test cases. For each test case:
The first line contains three integers $n$, $a$ and $b$ ($1 \le n \le 2000, 0 \le a \le b \le 10^{18}$).
The second line contains $n$ integers $s_0,s_1,\dots,s_{n-1}$ ($0 \le s_i \le 10^9$).
It is guaranteed that the sum of all $n$ does not exceed $20000$.
输出解释
For each test case, output an integer denoting the answer.
输入样例
4
3 2 6
2 1 3
5 2 7
2 1 5 1 2
4 4 8
2 1 5 17
3 5 9
2 5 2
输出样例
179
268
369
437
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6303

最后修改于 2020-10-25T23:30:07+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
12000/6000MS(Java/Others) 65535/65535K(Java/Others)