結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー KitataiKitatai
提出日時 2023-05-28 15:58:36
言語 Common Lisp
(sbcl 2.3.8)
結果
RE  
実行時間 -
コード長 590 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 32,828 KB
実行使用メモリ 32,276 KB
最終ジャッジ日時 2024-06-08 09:04:02
合計ジャッジ時間 1,356 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 8 ms
21,760 KB
testcase_21 AC 7 ms
21,888 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 08 JUN 2024 09:04:00 AM):

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

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

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

ソースコード

diff #

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

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