結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-07-10 19:21:58
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 420 ms / 1,000 ms
コード長 395 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 6,816 KB
実行使用メモリ 64,256 KB
最終ジャッジ日時 2024-05-09 04:30:48
合計ジャッジ時間 8,484 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 184 ms
29,440 KB
testcase_01 AC 118 ms
29,500 KB
testcase_02 AC 124 ms
29,400 KB
testcase_03 AC 126 ms
29,696 KB
testcase_04 AC 120 ms
29,568 KB
testcase_05 AC 119 ms
29,580 KB
testcase_06 AC 119 ms
29,568 KB
testcase_07 AC 120 ms
29,696 KB
testcase_08 AC 117 ms
29,568 KB
testcase_09 AC 118 ms
29,696 KB
testcase_10 AC 114 ms
29,472 KB
testcase_11 AC 118 ms
29,440 KB
testcase_12 AC 115 ms
29,568 KB
testcase_13 AC 115 ms
29,440 KB
testcase_14 AC 113 ms
29,532 KB
testcase_15 AC 116 ms
29,440 KB
testcase_16 AC 116 ms
29,440 KB
testcase_17 AC 117 ms
29,696 KB
testcase_18 AC 115 ms
29,392 KB
testcase_19 AC 143 ms
29,696 KB
testcase_20 AC 199 ms
33,408 KB
testcase_21 AC 117 ms
29,440 KB
testcase_22 AC 121 ms
29,568 KB
testcase_23 AC 116 ms
29,568 KB
testcase_24 AC 116 ms
29,696 KB
testcase_25 AC 263 ms
36,096 KB
testcase_26 AC 114 ms
29,688 KB
testcase_27 AC 114 ms
29,440 KB
testcase_28 AC 114 ms
29,568 KB
testcase_29 AC 115 ms
29,696 KB
testcase_30 AC 118 ms
29,568 KB
testcase_31 AC 117 ms
29,568 KB
testcase_32 AC 182 ms
32,256 KB
testcase_33 AC 418 ms
44,816 KB
testcase_34 AC 420 ms
44,928 KB
testcase_35 AC 256 ms
64,256 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