結果

問題 No.112 ややこしい鶴亀算
ユーザー Common Lisp
提出日時 2024-10-31 00:18:04
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 368 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 33,604 KB
実行使用メモリ 30,120 KB
最終ジャッジ日時 2024-10-31 00:18:06
合計ジャッジ時間 1,902 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 31 OCT 2024 12:18:04 AM):

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

ソースコード

diff #

(defun main (&rest argv)
  (declare (ignorable argv))
  (let* ((n (read))
         (a (make-array n))
         (p 0)
         (q 0))
    (dotimes (i n)
      (setf (aref a i) (read)))
    (let ((b (floor (reduce #'+ a) (1- n))))
      (dotimes (i n)
        (if (= 2 (- b (aref a i)))
            (incf p)
            (incf q))))
    (format t "~d ~d~%" p q)))

(main)
0