import sys
input = sys.stdin.readline
MIISS = lambda: map(int, input().strip().split())
dp = [[0] * 100_001 for _ in range(4)]
dp[1][1] = 1
dp[2][2] = 1
dp[1][3], dp[2][3], dp[3][3] = 1, 1, 1
for i in range(4, 100_001):
dp[1][i] = (dp[2][i - 1] + dp[3][i - 1]) % 1_000_000_009
dp[2][i] = (dp[1][i - 2] + dp[3][i - 2]) % 1_000_000_009
dp[3][i] = (dp[1][i - 3] + dp[2][i - 3]) % 1_000_000_009
T = int(input())
for _ in range(T):
tmp = int(input())
print((dp[1][tmp] + dp[2][tmp] + dp[3][tmp])% 1_000_000_009)
728x90
'즐거운 PS 👩💻🥰' 카테고리의 다른 글
[백준-파이썬] 12851: 숨바꼭질 2 (0) | 2021.12.30 |
---|---|
[백준-파이썬] 15927: 회문은 회문아니야! (0) | 2021.12.28 |
[백준-파이썬] 1932: 정수 삼각형 (0) | 2021.12.26 |
[백준-파이썬] 1501: 영어 읽기 (0) | 2021.12.25 |
[백준-파이썬] 1195: 킥다운 (0) | 2021.12.24 |