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

建议使用的浏览器:

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

6965:I love string

题目描述
Mr X likes to play string games.

Mr X has an operation sequence. This operation sequence can be written as a string. For each operation, the next character of the operation sequence can be inserted before or after the current string. For example, my operation sequence is "aabac", suppose the sequence obtained after the first four operations is "baaa", then after the last operation, the string may become "baaac" or "cbaaa". It can be seen that there is only one operation method for the first operation. For other operations, there are only two methods of operation.

For each operation method, there will be a score. The smaller the lexicographic order of the final string, the higher the final score.

Then, for a given operation sequence, how many operation methods can get the maximum score.

The two operation methods are different. If and only if there is a certain operation (not the first operation), one operation will be inserted before the current string, and the other operation will be inserted after the current string.
输入解释
Enter a positive integer $T$ ($T \leq 10$) on the first line to represent the number of test cases.

For each test case:

the first line contains a integer $n$ ($1 \leq n \leq 100000$) to represent the length of the string.

the second line contains a string of lowercase letters , which represents the sequence of operations.
输出解释
For each test case, output a line of a positive integer to represent the number of schemes, and the answer is modulo $1000000007$
输入样例
1
5
abcde
输出样例
1

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

源链接: HDU-6965

最后修改于 2021-10-23T19:10:50+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 524288/524288K(Java/Others)