結果

問題 No.44 DPなすごろく
ユーザー Common Lisp
提出日時 2024-10-25 14:30:32
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 333 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 39,532 KB
実行使用メモリ 30,016 KB
最終ジャッジ日時 2024-10-25 14:30:35
合計ジャッジ時間 1,897 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 25 OCT 2024 02:30:32 PM):

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

ソースコード

diff #

(defun main (&rest argv)
  (declare (ignorable argv))
  (let* ((n (read))
         (dp (make-array (+ n 1) :initial-element 0)))
    (setf (aref dp 0) 1)
    (dotimes (i n)
      (incf (aref dp (+ i 1)) (aref dp i))
      (when (<= (+ i 2) n)
        (incf (aref dp (+ i 2)) (aref dp i))))
    (format t "~d~%" (aref dp n))))

(main)
0