結果

問題 No.156 キャンディー・ボックス
コンテスト
ユーザー pekempey
提出日時 2016-06-23 17:00:08
言語 Scheme
(Gauche-0.9.15)
コンパイル:
true
実行:
gosh _filename_
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 522 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 125 ms
コンパイル使用メモリ 6,400 KB
実行使用メモリ 16,384 KB
最終ジャッジ日時 2026-03-27 00:48:08
合計ジャッジ時間 3,889 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

(define (iota n . args)
  (let ((start (if (pair? args) (car args) 0))
        (step  (if (and (pair? args) (pair? (cdr args))) (cadr args) 1)))
    (let loop ((m n) (last (+ start (* step (- n 1)))) (a '()))
      (if (zero? m)
          a
	  (loop (- m 1) (- last step) (cons last a))))))

(define (solve M C)
  (if (null? C)
      0
      (if (>= M (car C))
	  (+ 1 (solve (- M (car C)) (cdr C)))
	  0)))
		
(display (let* ((N (read)) (M (read)) (C (sort (map (lambda (x) (read)) (iota N)) <))) (solve M C)))
(newline)
0