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

建议使用的浏览器:

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

6942:CCPC Strings

题目描述
A string whose each character is either `C` or `P` is called a *CP-String*, so there are $2^N$ different *CP-Strings* of length $N$. We define the *CCPCness* of a *CP-String* as the number of the most non-overlapping `CCPC` as its substrings.

For example, the *CCPCness* of `CCPCCCPC` is $2$, but the *CCPCness* of `CCPCCPC` is $1$ because the chosen `CCPC` substrings can not overlaps.

You are given an integer $N$, and you need to calculate the sum of *CCPCness* of all the $2^N$ different *CP-Strings* of length $N$. The answer may be too large, so you just need to output it modulo $(10^9+7)$.
输入解释
The first line of input contains an integer $T$ ($1\leq T\leq 10^5$), denoting the number of test cases.

For each test case, there is one line with one integer $N$ ($1\leq N\leq 10^9$).
输出解释
For each test case, print one integer in one line, denoting your answer modulo $(10^9+7)$.
输入样例
7
3
4
5
6
7
10
123456789
输出样例
0
1
4
12
31
417
11557040

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

源链接: HDU-6942

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

共提交 0

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