結果

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

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

ソースコード

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))))
    (when (= n 1)
          (let ((r (aref p 0)))
            (format t "~d~%" (if (zerop r)
            					 0
            					 (if (zerop (mod r 9))
            					     9
            					     (mod r 9))))))
    (let ((r (reduce #'(lambda (x acc) (mod (* x acc) 9)) p)))
      (format t "~d~%" (if (zerop r)
                           9
                           r)))))

(main)
0