結果
問題 | No.2299 Antitypoglycemia |
ユーザー |
![]() |
提出日時 | 2024-10-28 21:48:43 |
言語 | Common Lisp (sbcl 2.5.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 579 bytes |
コンパイル時間 | 339 ms |
コンパイル使用メモリ | 37,548 KB |
実行使用メモリ | 32,780 KB |
最終ジャッジ日時 | 2024-10-28 21:48:45 |
合計ジャッジ時間 | 2,100 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 28 OCT 2024 09:48:43 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.043
ソースコード
(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 ndo (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)