結果

問題 No.1237 EXP Multiple!
コンテスト
ユーザー motoshira
提出日時 2020-10-14 22:13:03
言語 Common Lisp
(sbcl 2.6.3)
コンパイル:
sbclc _filename_
実行:
sbcl --script Main.fasl
結果
RE  
実行時間 -
コード長 620 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 154 ms
コンパイル使用メモリ 38,304 KB
実行使用メモリ 35,908 KB
最終ジャッジ日時 2026-04-03 02:14:08
合計ジャッジ時間 3,588 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge4_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11 WA * 4 RE * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 03 APR 2026 02:14:04 AM):

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

ソースコード

diff #
raw source code

(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)
0