結果
問題 | No.1237 EXP Multiple! |
ユーザー | motoshira |
提出日時 | 2020-10-14 22:15:21 |
言語 | Common Lisp (sbcl 2.3.8) |
結果 |
WA
|
実行時間 | - |
コード長 | 770 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 32,976 KB |
実行使用メモリ | 33,680 KB |
最終ジャッジ日時 | 2023-09-28 00:58:49 |
合計ジャッジ時間 | 3,162 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 8 ms
27,004 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 72 ms
27,956 KB |
testcase_06 | WA | - |
testcase_07 | AC | 73 ms
31,548 KB |
testcase_08 | WA | - |
testcase_09 | AC | 73 ms
29,920 KB |
testcase_10 | AC | 74 ms
31,712 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 81 ms
27,964 KB |
testcase_14 | AC | 82 ms
27,896 KB |
testcase_15 | AC | 79 ms
27,880 KB |
testcase_16 | AC | 80 ms
27,980 KB |
testcase_17 | AC | 81 ms
27,896 KB |
testcase_18 | AC | 81 ms
27,980 KB |
testcase_19 | AC | 75 ms
27,936 KB |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 28 SEP 2023 12:58:45 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.008
ソースコード
(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 (if (every (lambda (x) (<= 1 x 3)) a) (sub a) -1))))))) (main)