結果
| 問題 | 
                            No.2752 文字列の数え上げ mod 998244353
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-05-11 13:52:44 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 632 bytes | 
| コンパイル時間 | 241 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 21,248 KB | 
| 最終ジャッジ日時 | 2024-12-20 08:29:56 | 
| 合計ジャッジ時間 | 16,411 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 20 TLE * 5 | 
ソースコード
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] * 60
for i in range(60):
    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(60):
        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)