結果
問題 |
No.3036 Nauclhlt型文字列
|
ユーザー |
![]() |
提出日時 | 2025-06-12 18:49:56 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 733 bytes |
コンパイル時間 | 227 ms |
コンパイル使用メモリ | 82,584 KB |
実行使用メモリ | 67,768 KB |
最終ジャッジ日時 | 2025-06-12 18:49:59 |
合計ジャッジ時間 | 2,161 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 15 |
ソースコード
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)