結果

問題 No.3036 Nauclhlt型文字列
ユーザー gew1fw
提出日時 2025-06-12 13:48:35
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 733 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 82,956 KB
実行使用メモリ 67,944 KB
最終ジャッジ日時 2025-06-12 13:48:50
合計ジャッジ時間 2,640 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = (ord('\n') ** ord('\t')) + ord('\a')

def mul(a, b):
    return [
        [(a[0][0]*b[0][0] + a[0][1]*b[1][0]) % mod,
         (a[0][0]*b[0][1] + a[0][1]*b[1][1]) % mod],
        [(a[1][0]*b[0][0] + a[1][1]*b[1][0]) % mod,
         (a[1][0]*b[0][1] + a[1][1]*b[1][1]) % mod]
    ]

def pow_matrix(n):
    res = [[True, False], [False, True]]
    m = [[True, True], [True, False]]
    while n:
        if n & True:
            res = mul(res, m)
        m = mul(m, m)
        n >>= True
    return res

for _ in range(int(input())):
    n = int(input())
    if n == False:
        print((True + True) % mod)
        continue
    mat = pow_matrix(n - True)
    a = (mat[0][0] * True + mat[0][1] * (True + True)) % mod
    print(a)
0