結果

問題 No.2752 文字列の数え上げ mod 998244353
ユーザー keiden
提出日時 2024-09-13 12:28:01
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 1,355 ms / 2,000 ms
コード長 582 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 6,940 KB
実行使用メモリ 35,156 KB
最終ジャッジ日時 2024-09-13 12:28:11
合計ジャッジ時間 9,476 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

(import
  (scheme base)
  (scheme read)
  (scheme write)
  (gauche base)
  (srfi 94)
)


(define yuki2752
  (let*
    (
      (alpha 26)
      (ratio 26)
      (mod998-const 998244353)
      (mod998-inverse (expt-mod (- alpha 1) (- mod998-const 2) mod998-const))
      (mod998 (lambda (x) (modulo x mod998-const)))
      (solver (lambda (x) (mod998 (* (mod998 (* alpha (- (expt-mod ratio x mod998-const) 1))) mod998-inverse)))))
    (let*
      ((n (read)))
      (do ((i 1 (+ i 1)))
        ((> i n) )
        (begin
          (write (solver (read)))
          (display "\n"))))))
0