結果

問題 No.2326 Factorial to the Power of Factorial to the...
コンテスト
ユーザー Kitatai
提出日時 2023-05-28 15:44:17
言語 Common Lisp
(sbcl 2.6.3)
コンパイル:
sbclc _filename_
実行:
sbcl --script Main.fasl
結果
RE  
実行時間 -
コード長 501 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,093 ms
コンパイル使用メモリ 29,952 KB
実行使用メモリ 125,696 KB
最終ジャッジ日時 2026-06-01 23:43:03
合計ジャッジ時間 10,985 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other RE * 18 TLE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 01 JUN 2026 11:42:51 PM):

; file: /home/judge/data/code/Main.lisp
; in: DEFUN SOLVE
;     (RUI F F)
; 
; caught WARNING:
;   undefined variable: COMMON-LISP-USER::F

;     (SETQ F (FACTORIAL N))
; 
; caught WARNING:
;   undefined variable: COMMON-LISP-USER::F
; 
; compilation unit finished
;   Undefined variable:
;     F
;   caught 2 WARNING conditions

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

ソースコード

diff #
raw source code

(defun facd (n p a) 
    (cond ((equal n 0) 0)
        ((not (equal (mod a p) 0)) (facd (- n 1) p (* a (- n 1))))
        (t (mod (+ (facd n p (/ a p)) 1) 1000000007))
    )
)

(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 f (factorial n))
    (mod (* (facd (+ n 1) p 1) (rui f f)) 1000000007) 
)

(princ (solve (read) (read)))
0