結果
| 問題 |
No.156 キャンディー・ボックス
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-11 15:06:31 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 472 bytes |
| コンパイル時間 | 1,451 ms |
| コンパイル使用メモリ | 32,880 KB |
| 実行使用メモリ | 25,664 KB |
| 最終ジャッジ日時 | 2025-05-11 15:06:34 |
| 合計ジャッジ時間 | 3,387 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 11 MAY 2025 03:06:31 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.056
ソースコード
(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)