結果

問題 No.156 キャンディー・ボックス
ユーザー pekempeypekempey
提出日時 2016-06-23 17:00:08
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 522 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 5,228 KB
実行使用メモリ 11,932 KB
最終ジャッジ日時 2023-09-19 03:10:38
合計ジャッジ時間 2,650 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
11,872 KB
testcase_01 AC 19 ms
11,688 KB
testcase_02 AC 19 ms
11,728 KB
testcase_03 AC 19 ms
11,688 KB
testcase_04 AC 19 ms
11,672 KB
testcase_05 AC 19 ms
11,884 KB
testcase_06 AC 20 ms
11,704 KB
testcase_07 AC 19 ms
11,664 KB
testcase_08 AC 19 ms
11,864 KB
testcase_09 AC 19 ms
11,672 KB
testcase_10 AC 19 ms
11,684 KB
testcase_11 AC 19 ms
11,860 KB
testcase_12 AC 19 ms
11,900 KB
testcase_13 AC 18 ms
11,864 KB
testcase_14 AC 19 ms
11,676 KB
testcase_15 AC 19 ms
11,868 KB
testcase_16 AC 19 ms
11,932 KB
testcase_17 AC 19 ms
11,700 KB
testcase_18 AC 19 ms
11,720 KB
testcase_19 AC 18 ms
11,868 KB
testcase_20 AC 18 ms
11,744 KB
testcase_21 AC 19 ms
11,684 KB
testcase_22 AC 19 ms
11,796 KB
testcase_23 AC 19 ms
11,884 KB
testcase_24 AC 19 ms
11,908 KB
testcase_25 AC 19 ms
11,924 KB
testcase_26 AC 19 ms
11,896 KB
testcase_27 AC 19 ms
11,864 KB
testcase_28 AC 19 ms
11,700 KB
testcase_29 AC 19 ms
11,780 KB
testcase_30 AC 19 ms
11,868 KB
testcase_31 AC 19 ms
11,772 KB
testcase_32 AC 18 ms
11,700 KB
testcase_33 AC 19 ms
11,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(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