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

建议使用的浏览器:

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

5580:Happiness of Frog

题目描述
Frog loves symmetry. When he sees an array of numbers, the first thing he'll do, is to count the number of sub-arrays which is symmetric (when read from left to right, or in the reverse direction, it will be the same). The more sub-arrays frog finds, the happier he will be.

We human beings are frog's best friends. For each array, we will shuffle the array, changing some numbers' positions if possible, to mostly satisfy the frog.

Now we wonder the maximum number of symmetric sub-arrays frog will find. And the number of different arrays to reach this maximum result. Two arrays $a$ and $b$ are considered different, if at least for one position $i$, there are $a_i \neq b_i$.
输入解释
First line contains an integer $T$, which indicates the number of test cases.

Every test case begins with an integers $N$, which is the length of the array.

The second line contains $N$ numbers $a_1$, $a_2$, $\cdots$, $a_N$, indicating the elements in the array.

$1 \leq T \leq 100$.

for 60% data, $1 \leq N \leq 10$ and $1 \leq a_i \leq 5$.

for 80% data, $1 \leq N \leq 100$ and $1 \leq a_i \leq 20$.

for 100% data, $1 \leq N \leq 3000$ and $1 \leq a_i \leq 70$.
输出解释
For every test case, you should output "Case #x: y z", where $x$ indicates the case number and counts from $1$, $y$ is the maximum number of symmetric sub-arrays frog will find, and $z$ is the number of different arrays to reach this maximum result.

Because $z$ could be very large, just mod it with $10^9 + 7$.
输入样例
2
3
1 2 3
4
1 3 2 3
输出样例
Case #1: 3 6
Case #2: 5 10
提示
In the second sample, {1,3,2,3} itself is one of the solutions, there are 5 sub-arrays which is symmetric, {1}, {3}, {2}, {3}(for a second time), and {3,2,3}. But {3,1,2,3} is not, which only contains 4 symmetric sub-arrays.
来自杭电HDUOJ的附加信息
Recommend wange2014

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

源链接: HDU-5580

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

共提交 0

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