結果
| 問題 |
No.2752 文字列の数え上げ mod 998244353
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-11 13:46:48 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 632 bytes |
| コンパイル時間 | 214 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-12-20 08:29:39 |
| 合計ジャッジ時間 | 12,669 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 WA * 7 TLE * 4 |
ソースコード
mod = 998244353
#aのb乗をmで割った余りを出力する
def Power(a:int,b:int,m:int=mod)->int:
ans = 1
i = 0
while True:
w = (1<<i)
if b < w : break
if b & w : ans = (ans * a) % m
a = (a * a) % m
i += 1
return ans
Power26 = [0] * 30
for i in range(30):
Power26[i] = Power(26,(1<<i))
T = int(input())
c = Power(25,mod-2)
for t in range(T):
L = int(input())
ans = 1
for i in range(30):
if (L+1) < (1<<i) : break
if (L+1) & (1<<i) : ans *= Power26[i] % mod
ans -= 26
if ans < 0 : ans += mod
ans = ans * c % mod
print(ans)