結果

問題 No.156 キャンディー・ボックス
ユーザー Rin
提出日時 2015-09-07 16:53:16
言語 Scheme
(Gauche-0.9.15)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 32 ms
コンパイル使用メモリ 5,120 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-07-19 04:53:26
合計ジャッジ時間 1,961 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 3 WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (System.out.println x)
  (begin
    (display x)
    (newline)
  )
)

(let (
      (N (read))
      (M (read))
     )
  (let loop(
            (foo (read))
            (bar '())
           )
    (if (eof-object? foo)
        (let loop2(
                   (Rmn M)
                   (Empty 0)
                   (Boxes (sort bar <))
                   )
          (cond
            ((null? Boxes) (System.out.println Empty))
            ((< (- Rmn (car Boxes)) 0) (System.out.println Empty))
            ((= (- Rmn (car Boxes)) 0) (System.out.println (+ Empty 1)))
            (else (loop2 (- Rmn (car Boxes)) (+ Empty 1) (cdr Boxes)))
          )
        )
        (loop (read) (cons foo bar))
    )
  )
)
0