結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-07-10 19:21:58
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 380 ms / 1,000 ms
コード長 395 bytes
コンパイル時間 54 ms
コンパイル使用メモリ 6,692 KB
実行使用メモリ 44,996 KB
最終ジャッジ日時 2024-12-15 13:59:29
合計ジャッジ時間 7,230 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
29,568 KB
testcase_01 AC 104 ms
29,440 KB
testcase_02 AC 105 ms
29,440 KB
testcase_03 AC 110 ms
29,568 KB
testcase_04 AC 102 ms
29,408 KB
testcase_05 AC 106 ms
29,696 KB
testcase_06 AC 104 ms
29,440 KB
testcase_07 AC 101 ms
29,568 KB
testcase_08 AC 107 ms
29,568 KB
testcase_09 AC 105 ms
29,436 KB
testcase_10 AC 108 ms
29,452 KB
testcase_11 AC 106 ms
29,408 KB
testcase_12 AC 104 ms
29,400 KB
testcase_13 AC 104 ms
29,440 KB
testcase_14 AC 104 ms
29,696 KB
testcase_15 AC 101 ms
29,436 KB
testcase_16 AC 103 ms
29,696 KB
testcase_17 AC 105 ms
29,696 KB
testcase_18 AC 105 ms
29,440 KB
testcase_19 AC 129 ms
29,696 KB
testcase_20 AC 175 ms
33,164 KB
testcase_21 AC 104 ms
29,440 KB
testcase_22 AC 104 ms
29,440 KB
testcase_23 AC 101 ms
29,696 KB
testcase_24 AC 104 ms
29,568 KB
testcase_25 AC 249 ms
36,128 KB
testcase_26 AC 106 ms
29,440 KB
testcase_27 AC 106 ms
29,580 KB
testcase_28 AC 103 ms
29,568 KB
testcase_29 AC 103 ms
29,568 KB
testcase_30 AC 109 ms
29,400 KB
testcase_31 AC 104 ms
29,440 KB
testcase_32 AC 163 ms
32,232 KB
testcase_33 AC 380 ms
44,996 KB
testcase_34 AC 374 ms
44,836 KB
testcase_35 AC 229 ms
36,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env gosh

(use math.prime)
(use srfi-1)
(use srfi-42)

(define (count-seqs n l)
    (begin
        (define (x-max d) (- l (* d (- n 1))))
        (let ((d-max (div l (- n 1))))
            (sum-ec
                (: d (take-while
                    (lambda (x) (<= x d-max)) *primes*))
                (+ 1 (x-max d))))))

(let* ((n (read)) (l (read)))
    (print (count-seqs n l)))
0