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

建议使用的浏览器:

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

5496:Beauty of Sequence

题目描述
Sequence is beautiful and the beauty of an integer sequence is defined as follows: removes all but the first element from every consecutive group of equivalent elements of the sequence (i.e. unique function in C++ STL) and the summation of rest integers is the beauty of the sequence.

Now you are given a sequence $A$ of $n$ integers $\{a_1,a_2,...,a_n\}$. You need find the summation of the beauty of all the sub-sequence of $A$. As the answer may be very large, print it modulo $10^9+7$.

Note: In mathematics, a sub-sequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example $\{1,3,2\}$ is a sub-sequence of $\{1, 4, 3, 5, 2, 1\}$.
输入解释
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 an integer $n$ $(1 \le n \le 10^5)$, indicating the size of the sequence. The following line contains $n$ integers $a_1,a_2,...,a_n$, denoting the sequence $(1 \le a_i \le 10^9)$.

The sum of values $n$ for all the test cases does not exceed $2000000$.
输出解释
For each test case, print the answer modulo $10^9+7$ in a single line.
输入样例
3
5
1 2 3 4 5
4
1 2 1 3
5
3 3 2 1 2
输出样例
240
54
144
来自杭电HDUOJ的附加信息
Recommend hujie

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

源链接: HDU-5496

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

共提交 0

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