結果

問題 No.156 キャンディー・ボックス
ユーザー Common Lisp
提出日時 2024-10-08 12:44:15
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 826 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 35,108 KB
実行使用メモリ 21,888 KB
最終ジャッジ日時 2024-10-08 12:44:18
合計ジャッジ時間 2,254 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 08 OCT 2024 12:44:15 PM):

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

ソースコード

diff #
プレゼンテーションモードにする

; Ci
; m
; 1for
(defun main ()
(let* ((n (read))
(m (read))
(xs (sort (loop repeat n collect (read)) #'<)))
(loop for i below n
for s = (car xs) then (+ s (nth i xs))
until (> s m)
finally (princ i))
(terpri)))
(main)
; 2
; (defun scanl (fn init xs)
; (if (null xs)
; (list init)
; (cons init (scanl fn (funcall fn (car xs) init) (cdr xs)))))
; (defun main ()
; (let* ((n (read))
; (m (read))
; (xs (sort (loop repeat n collect (read)) #'<)))
; (princ (length (remove-if #'plusp (map 'list (lambda (x) (- x m)) (scanl #'+ (car xs) xs)))))
; (terpri)))
; (main)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0