結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー lloyzlloyz
提出日時 2023-01-20 00:07:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 686 ms / 1,000 ms
コード長 376 bytes
コンパイル時間 1,334 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 185,928 KB
最終ジャッジ日時 2023-09-04 19:02:40
合計ジャッジ時間 26,515 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 619 ms
185,780 KB
testcase_01 AC 646 ms
185,880 KB
testcase_02 AC 655 ms
185,836 KB
testcase_03 AC 629 ms
185,640 KB
testcase_04 AC 622 ms
185,632 KB
testcase_05 AC 633 ms
185,580 KB
testcase_06 AC 630 ms
185,860 KB
testcase_07 AC 658 ms
185,852 KB
testcase_08 AC 625 ms
185,804 KB
testcase_09 AC 632 ms
185,612 KB
testcase_10 AC 654 ms
185,616 KB
testcase_11 AC 639 ms
185,424 KB
testcase_12 AC 666 ms
185,492 KB
testcase_13 AC 639 ms
185,784 KB
testcase_14 AC 668 ms
185,880 KB
testcase_15 AC 624 ms
185,856 KB
testcase_16 AC 635 ms
185,820 KB
testcase_17 AC 668 ms
185,636 KB
testcase_18 AC 628 ms
185,664 KB
testcase_19 AC 632 ms
185,856 KB
testcase_20 AC 663 ms
185,876 KB
testcase_21 AC 630 ms
185,456 KB
testcase_22 AC 632 ms
185,628 KB
testcase_23 AC 645 ms
185,928 KB
testcase_24 AC 654 ms
185,788 KB
testcase_25 AC 632 ms
185,308 KB
testcase_26 AC 686 ms
185,864 KB
testcase_27 AC 636 ms
185,840 KB
testcase_28 AC 636 ms
185,800 KB
testcase_29 AC 628 ms
185,632 KB
testcase_30 AC 631 ms
185,776 KB
testcase_31 AC 654 ms
185,476 KB
testcase_32 AC 629 ms
185,924 KB
testcase_33 AC 634 ms
185,856 KB
testcase_34 AC 637 ms
185,644 KB
testcase_35 AC 644 ms
185,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

IsPrime = [True for _ in range(10**7 + 1)]
IsPrime[0] = IsPrime[1] = False
Primes = []
for p in range(2, 10**7 + 1):
    if IsPrime[p]:
        Primes.append(p)
        for i in range(p * p, 10**7 + 1, p):
            IsPrime[i] = False

n, l = map(int, input().split())
ans = 0
for p in Primes:
    if p * (n - 1) > l:
        break
    ans += l - p * (n - 1) + 1
print(ans)
0