結果

問題 No.5 数字のブロック
ユーザー RinRin
提出日時 2015-09-05 21:52:08
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 659 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 7,072 KB
実行使用メモリ 18,560 KB
最終ジャッジ日時 2024-11-18 07:34:48
合計ジャッジ時間 2,916 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

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 (or (= UsedBlocks N) (< (- RemainingCapacity (car bar)) 0))
              (System.out.println UsedBlocks)
              (loop2 (- RemainingCapacity (car bar)) (+ UsedBlocks 1) (cdr bar))
          )
        )
        (loop (cons foo ls) (read))
    )
  )
)
0