結果

問題 No.1237 EXP Multiple!
ユーザー motoshiramotoshira
提出日時 2020-10-14 22:07:07
言語 Common Lisp
(sbcl 2.3.8)
結果
RE  
実行時間 -
コード長 611 bytes
コンパイル時間 940 ms
コンパイル使用メモリ 24,292 KB
実行使用メモリ 30,872 KB
最終ジャッジ日時 2023-09-28 00:57:42
合計ジャッジ時間 3,291 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 -
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 28 SEP 2023 12:57:40 AM):
; processing (DEFPARAMETER *MOD* ...); 
; caught ERROR:
;   READ error during COMPILE-FILE:
;   
;     end of file on #<SB-INT:FORM-TRACKING-STREAM for "file /home/judge/data/code/Main.lisp" {10015388F3}>
;   
;     (in form starting at line: 3, column: 0, position: 33)
; 
; compilation unit aborted
;   caught 1 fatal ERROR condition
;   caught 1 ERROR condition

; compilation aborted after 0:00:00.025

ソースコード

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