結果
| 問題 | No.2752 文字列の数え上げ mod 998244353 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-10 22:17:05 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
WA
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 643 bytes |
| 記録 | |
| コンパイル時間 | 87 ms |
| コンパイル使用メモリ | 64,616 KB |
| 実行使用メモリ | 72,744 KB |
| 最終ジャッジ日時 | 2026-10-26 13:29:13 |
| 合計ジャッジ時間 | 4,061 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 WA * 1 |
ソースコード
MOD = 998244353
def mod_exp(base, exp, mod):
result = 1
while exp > 0:
if exp % 2 == 1:
result = (result * base) % mod
base = (base * base) % mod
exp //= 2
return result
def mod_inv(x, mod):
return mod_exp(x, mod - 2, mod)
def compute_string_count(L):
base = 26
power = L + 1
base_power_mod = mod_exp(base, power, MOD)
inverse_25 = mod_inv(25, MOD)
result = (base_power_mod - 1) * inverse_25 % MOD
return result
T = int(input())
results = []
for i in range(T):
L = int(input())
results.append(str(compute_string_count(L) - 1))
print("\n".join(results))