結果

問題 No.2299 Antitypoglycemia
コンテスト
ユーザー Common Lisp
提出日時 2024-10-28 21:48:43
言語 Common Lisp
(sbcl 2.6.9)
コンパイル:
sbclc _filename_
実行:
sbcl --script Main.fasl
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 579 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 210 ms
コンパイル使用メモリ 36,784 KB
実行使用メモリ 31,304 KB
最終ジャッジ日時 2026-10-15 02:03:26
合計ジャッジ時間 2,317 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 15 OCT 2026 02:03:22 AM):

; wrote /home/judge/data/code/Main.fasl
; compilation finished in 0:00:00.109

ソースコード

diff #
raw source code

(defconstant +mod+ 998244353)

(defun main (&rest argv)
  (declare (ignorable argv))
  (let* ((n (read))
         (a (read))
         (b (read))
         (fact-table (make-array (1+ n))))
    (setf (aref fact-table 0) 1)
    (loop for i from 1 to n
          do (setf (aref fact-table i) (mod (* i (aref fact-table (1- i))) +mod+)))
    (format t "~d~%" (if (= a b)
                         (- (aref fact-table n) (* 2 (aref fact-table (1- n))))
                         (mod (- (+ (aref fact-table n) (aref fact-table (- n 2))) (* 2 (aref fact-table (1- n)))) +mod+)))))

(main)
0