結果
| 問題 | No.2326 Factorial to the Power of Factorial to the... |
| コンテスト | |
| ユーザー |
Kitatai
|
| 提出日時 | 2023-05-28 16:05:44 |
| 言語 | Common Lisp (sbcl 2.6.3) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 593 bytes |
| 記録 | |
| コンパイル時間 | 139 ms |
| コンパイル使用メモリ | 30,208 KB |
| 実行使用メモリ | 24,192 KB |
| 最終ジャッジ日時 | 2026-06-02 00:30:21 |
| 合計ジャッジ時間 | 1,780 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | RE * 20 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 02 JUN 2026 12:30:19 AM): ; file: /home/judge/data/code/Main.lisp ; in: DEFUN SOLVE ; (RUI FAC FAC) ; ; caught WARNING: ; undefined variable: COMMON-LISP-USER::FAC ; (SETQ FAC (FACTORIAL N)) ; ; caught WARNING: ; undefined variable: COMMON-LISP-USER::FAC ; ; compilation unit finished ; Undefined variable: ; FAC ; caught 2 WARNING conditions ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.006
ソースコード
(defun facd (n p)
(prog (pp count)
(setq pp p)
(setq count 0)
loop
(if (> pp n) (return count)
(setq count (mod (+ count (/ (- n (mod n pp)) pp)) 1000000007))
)
(setq pp (* pp p))
(go loop)
)
)
(defun factorial (n)
(if (= n 1) 1
(mod (* n (factorial (- n 1))) 1000000007)
)
)
(defun rui (n p)
(if (= n 1) p
(mod (* p (rui (- n 1) p)) 1000000007)
)
)
(defun solve (n p)
(setq fac (factorial n))
(mod (* (facd n p) (rui fac fac)) 1000000007)
)
(princ (solve (read) (read)))
Kitatai