結果

問題 No.1237 EXP Multiple!
ユーザー motoshiramotoshira
提出日時 2020-10-14 22:08:03
言語 Common Lisp
(sbcl 2.3.8)
結果
WA  
実行時間 -
コード長 612 bytes
コンパイル時間 793 ms
コンパイル使用メモリ 34,956 KB
実行使用メモリ 33,660 KB
最終ジャッジ日時 2023-09-28 00:57:58
合計ジャッジ時間 4,891 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
22,976 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 72 ms
27,836 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 28 SEP 2023 12:57:51 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.078

ソースコード

diff #

(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))))
      (princ (if (some #'zerop a)
                 -1
                 (if (every (lambda (x)
                              (<= 1 x 3))
                            a)
                     (mod *mod* (reduce #'*
                                        (mapcar (lambda (x)
                                                  (expt x (fact x)))
                                                a)))
                     0))))))
(main)
0