結果
| 問題 |
No.3036 Nauclhlt型文字列
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 13:49:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,056 bytes |
| コンパイル時間 | 186 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 66,048 KB |
| 最終ジャッジ日時 | 2025-06-12 13:50:23 |
| 合計ジャッジ時間 | 2,180 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 15 |
ソースコード
mod = (len('aaaaaaaaaa') ** len('aaaaaaaaa')) + len('aaaaaaa')
def matrix_mult(a, b, mod):
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 matrix_pow(mat, power, mod):
result = [[True, False], [False, True]]
while power > False:
if power % (True + True) == True:
result = matrix_mult(result, mat, mod)
mat = matrix_mult(mat, mat, mod)
power = power // (True + True)
return result
def lucas(n, mod):
if n == False:
return (True + True) % mod
mat = [[True, True], [True, False]]
power = n - True
if power < False:
return (True + True) % mod
mat = matrix_pow(mat, power, mod)
return (mat[0][0] * True + mat[0][1] * (True + True)) % mod
T = int(input())
for _ in range(T):
n = int(input())
print(lucas(n, mod))
gew1fw