結果
| 問題 |
No.2326 Factorial to the Power of Factorial to the...
|
| コンテスト | |
| ユーザー |
Kitatai
|
| 提出日時 | 2023-05-28 16:30:11 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 842 bytes |
| コンパイル時間 | 278 ms |
| コンパイル使用メモリ | 32,580 KB |
| 実行使用メモリ | 49,152 KB |
| 最終ジャッジ日時 | 2024-12-27 11:27:46 |
| 合計ジャッジ時間 | 62,542 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 1 TLE * 19 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 27 DEC 2024 11:26:41 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.009
ソースコード
(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)
(prog (count)
(setq count 1)
loop
(if (= n 1) (return count)
(setq count (mod (* count n) 1000000007))
)
(setq n (- n 1))
(go loop)
)
)
(defun rui (n p)
(prog (count)
(setq count 1)
loop
(if (= p 0) (return count)
(setq count (mod (* count n) 1000000007))
)
(setq p (- p 1))
(go loop)
)
)
(defun solve (n p)
(mod (* (facd n p) (rui (factorial n) (factorial n))) 1000000007)
)
(princ (solve (read) (read)))
Kitatai