結果

問題 No.5 数字のブロック
ユーザー Rin
提出日時 2015-09-05 21:47:09
言語 Scheme
(Gauche-0.9.15)
結果
RE  
実行時間 -
コード長 637 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 5,120 KB
実行使用メモリ 18,688 KB
最終ジャッジ日時 2024-07-19 04:14:43
合計ジャッジ時間 2,451 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 RE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

(let (
      (Capacity (read))
      (N (read))
     )
  (let loop(
            (ls '())
            (foo (read))
           )
    (if (eof-object? foo)
        (let loop2(
                   (RemainingCapacity Capacity)
                   (UsedBlocks 0)
                   (bar (sort ls <))
                  )
          (if (< (- RemainingCapacity (car bar)) 0)
              (System.out.println UsedBlocks)
              (loop2 (- RemainingCapacity (car bar)) (+ UsedBlocks 1) (cdr bar))
          )
        )
        (loop (cons foo ls) (read))
    )
  )
)
0