QOJ.ac

QOJ

时间限制: 2 s 内存限制: 512 MB 总分: 100

#874. 长网格覆盖

统计

我们有一个高度为 3、宽度为 $n$ 的网格,以及一些占据 3 个相邻单元格的拼图块。给定 $n$,确定填充该网格的方法数,使得每个单元格恰好被一个拼图块覆盖,且没有任何拼图块超出网格边界。以下是宽度为 4 的网格的一种填充示例:

注意,任何拼图块都是该示例中拼图块的旋转。请计算答案对 $10^9 + 7$ 取模的结果。

输入格式

第一行包含一个整数 $t$,表示测试用例的数量 ($1 \le t \le 100$)。 每个测试用例占一行,包含一个整数 $n$ ($1 \le n \le 10^{18}$),表示网格的宽度。

输出格式

对于每个测试用例,输出一行,包含一个整数:在上述条件下填充网格的方法数,对 $10^9 + 7$ 取模。

样例

输入 1

3
1
2
3

输出 1

1
3
10

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.