結果

問題 No.933 おまわりさんこいつです
ユーザー Common Lisp
提出日時 2024-11-10 03:26:16
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 153 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 37,540 KB
実行使用メモリ 22,912 KB
最終ジャッジ日時 2024-11-10 03:26:18
合計ジャッジ時間 1,983 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 10 NOV 2024 03:26:16 AM):

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

ソースコード

diff #

(defun main (&rest argv)
  (declare (ignorable argv))
  (let* ((n (read))
         (p (make-array n :element-type 'integer)))
    (dotimes (i n)
      (let* ((q (read)))
        (if (zerop q)
            (progn
             (format t "0~%")
             (return-from main 0))
            (setf (aref p i) q))))
    (let ((r (if (= n 1)
                 (mod (aref p 0) 9)
                 (reduce #'(lambda (x acc) (mod (* x acc) 9)) p))))
      (format t "~d~%" (if (zerop r)
                           9
                           r)))))

(main)
0