結果
| 問題 | No.156 キャンディー・ボックス |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-11 15:06:31 |
| 言語 | Common Lisp (sbcl 2.6.3) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 472 bytes |
| 記録 | |
| コンパイル時間 | 745 ms |
| コンパイル使用メモリ | 27,264 KB |
| 実行使用メモリ | 19,584 KB |
| 最終ジャッジ日時 | 2026-07-10 14:15:27 |
| 合計ジャッジ時間 | 2,785 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 10 JUL 2026 02:15:24 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.025
ソースコード
(defparameter temp (read-from-string (concatenate 'string "(" (read-line) ")")))
(defparameter N (nth 0 temp))
(defparameter M (nth 1 temp))
(defparameter C (read-from-string (concatenate 'string "(" (read-line) ")")))
(setf C (sort C #'< ))
;(print C)
(defparameter sum 0)
(defparameter cnt 0)
(loop while (< sum M ) do
(if (<= (+ sum (car C)) M) (incf cnt))
(setq sum (+ sum (car C)))
(setq C (cdr C))
)
(format t "~d~%" cnt)