結果
問題 | No.1237 EXP Multiple! |
ユーザー | motoshira |
提出日時 | 2020-10-14 22:13:03 |
言語 | Common Lisp (sbcl 2.3.8) |
結果 |
RE
|
実行時間 | - |
コード長 | 620 bytes |
コンパイル時間 | 848 ms |
コンパイル使用メモリ | 29,396 KB |
実行使用メモリ | 34,016 KB |
最終ジャッジ日時 | 2023-09-28 00:58:32 |
合計ジャッジ時間 | 3,944 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 7 ms
22,984 KB |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | AC | 72 ms
27,928 KB |
testcase_06 | WA | - |
testcase_07 | AC | 73 ms
27,804 KB |
testcase_08 | WA | - |
testcase_09 | AC | 76 ms
29,864 KB |
testcase_10 | AC | 73 ms
27,828 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 78 ms
27,812 KB |
testcase_14 | AC | 81 ms
31,584 KB |
testcase_15 | AC | 81 ms
31,640 KB |
testcase_16 | AC | 77 ms
27,808 KB |
testcase_17 | AC | 79 ms
29,920 KB |
testcase_18 | AC | 78 ms
27,888 KB |
testcase_19 | AC | 73 ms
29,848 KB |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 28 SEP 2023 12:58:27 AM): ; processing (DEFPARAMETER *MOD* ...) ; processing (DEFUN FACT ...) ; processing (DEFUN MAIN ...) ; processing (MAIN) ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.092
ソースコード
(defparameter *mod* 1000000007) (defun fact (x) (if (zerop x) 1 (* x (fact (1- x))))) (defun main () (let ((n (read))) (let ((a (loop repeat n collect (read)))) (labels ((sub (xs &optional (res 1)) (cond ((null xs) (mod *mod* res)) ((> res *mod*) -1) (t (sub (rest xs) (* (expt (first xs) (fact (first xs))) res)))))) (princ (if (some #'zerop a) -1 (sub a))))))) (main)