結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-07-10 19:21:58
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 438 ms / 1,000 ms
コード長 395 bytes
コンパイル時間 33 ms
コンパイル使用メモリ 5,300 KB
実行使用メモリ 39,084 KB
最終ジャッジ日時 2023-08-21 22:18:34
合計ジャッジ時間 7,280 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
22,476 KB
testcase_01 AC 102 ms
22,652 KB
testcase_02 AC 101 ms
22,640 KB
testcase_03 AC 112 ms
22,500 KB
testcase_04 AC 104 ms
22,420 KB
testcase_05 AC 103 ms
22,624 KB
testcase_06 AC 105 ms
22,408 KB
testcase_07 AC 105 ms
22,564 KB
testcase_08 AC 103 ms
22,332 KB
testcase_09 AC 105 ms
22,448 KB
testcase_10 AC 105 ms
22,552 KB
testcase_11 AC 103 ms
22,484 KB
testcase_12 AC 104 ms
22,612 KB
testcase_13 AC 104 ms
22,412 KB
testcase_14 AC 103 ms
22,460 KB
testcase_15 AC 101 ms
22,388 KB
testcase_16 AC 100 ms
24,456 KB
testcase_17 AC 100 ms
22,440 KB
testcase_18 AC 99 ms
22,436 KB
testcase_19 AC 133 ms
23,716 KB
testcase_20 AC 209 ms
26,720 KB
testcase_21 AC 99 ms
22,328 KB
testcase_22 AC 99 ms
22,384 KB
testcase_23 AC 99 ms
22,488 KB
testcase_24 AC 100 ms
22,332 KB
testcase_25 AC 266 ms
31,416 KB
testcase_26 AC 103 ms
22,556 KB
testcase_27 AC 103 ms
22,364 KB
testcase_28 AC 102 ms
22,500 KB
testcase_29 AC 101 ms
22,552 KB
testcase_30 AC 100 ms
22,540 KB
testcase_31 AC 102 ms
22,524 KB
testcase_32 AC 191 ms
25,412 KB
testcase_33 AC 438 ms
39,084 KB
testcase_34 AC 429 ms
38,920 KB
testcase_35 AC 254 ms
29,848 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