結果
| 問題 | No.1237 EXP Multiple! |
| コンテスト | |
| ユーザー |
motoshira
|
| 提出日時 | 2020-10-14 22:21:42 |
| 言語 | Common Lisp (sbcl 2.6.3) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 772 bytes |
| 記録 | |
| コンパイル時間 | 177 ms |
| コンパイル使用メモリ | 36,448 KB |
| 実行使用メモリ | 36,268 KB |
| 最終ジャッジ日時 | 2026-04-03 02:14:17 |
| 合計ジャッジ時間 | 3,140 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 14 WA * 5 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 03 APR 2026 02:14:09 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.009
ソースコード
(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*) *mod*)
(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)
0)))))))
(main)
motoshira