AM. 矩阵加速(数列)

    Type: RemoteJudge 1000ms 125MiB

矩阵加速(数列)

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

已知一个数列 aa,它满足:

$$a_x= \begin{cases} 1 & x \in\{1,2,3\}\\ a_{x-1}+a_{x-3} & x \geq 4 \end{cases} $$

aa 数列的第 nn 项对 109+710^9+7 取余的值。

输入格式

第一行一个整数 TT,表示询问个数。

以下 TT 行,每行一个正整数 nn

输出格式

每行输出一个非负整数表示答案。

3
6
8
10

4
9
19

提示

  • 对于 30%30\% 的数据 n100n \leq 100
  • 对于 60%60\% 的数据 n2×107n \leq2 \times 10^7
  • 对于 100%100\% 的数据 1T1001 \leq T \leq 1001n2×1091 \leq n \leq 2 \times 10^9

【A班】数学问题S

Not Claimed
Status
Done
Problem
62
Open Since
2025-10-22 0:00
Deadline
2025-11-28 23:59
Extension
24 hour(s)