結果

問題 No.5 数字のブロック
ユーザー まんしmaNNshi
提出日時 2025-03-20 15:14:23
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 280 ms / 5,000 ms
コード長 472 bytes
コンパイル時間 1,611 ms
コンパイル使用メモリ 35,124 KB
実行使用メモリ 81,748 KB
最終ジャッジ日時 2025-03-20 15:14:29
合計ジャッジ時間 5,935 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 20 MAR 2025 03:14:23 PM):

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

ソースコード

diff #

(defvar L (read-line))
(setq L (parse-integer L))
(defvar N (read-line))
(setq N (parse-integer N))
(defvar W (read-line))
(setq W  (read-from-string (concatenate 'string "(" W ")" ) ) )
(defvar newW)
(setq newW '())
(loop for x in W do
    (setq neww (append newW (list x))))
(setq W newW)
(setq W (sort W #'<))
(defvar SUM 0)
(defvar ANS 0)
(defvar x)
(loop for x in W do
    (if (> (+ SUM x) L) (return) (progn (incf ANS) (setq SUM (+ SUM x))))
)
(format 't "~d~%" ANS)
0