結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー titiatitia
提出日時 2023-02-27 05:58:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 474 ms / 1,000 ms
コード長 501 bytes
コンパイル時間 1,500 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 201,372 KB
最終ジャッジ日時 2023-10-12 17:51:39
合計ジャッジ時間 19,221 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 459 ms
201,100 KB
testcase_01 AC 456 ms
201,164 KB
testcase_02 AC 465 ms
201,184 KB
testcase_03 AC 465 ms
201,324 KB
testcase_04 AC 467 ms
201,284 KB
testcase_05 AC 462 ms
201,348 KB
testcase_06 AC 463 ms
201,044 KB
testcase_07 AC 460 ms
201,324 KB
testcase_08 AC 457 ms
201,308 KB
testcase_09 AC 462 ms
201,080 KB
testcase_10 AC 460 ms
201,216 KB
testcase_11 AC 467 ms
201,076 KB
testcase_12 AC 456 ms
201,184 KB
testcase_13 AC 467 ms
201,280 KB
testcase_14 AC 466 ms
200,768 KB
testcase_15 AC 465 ms
201,188 KB
testcase_16 AC 466 ms
201,300 KB
testcase_17 AC 461 ms
201,088 KB
testcase_18 AC 466 ms
201,308 KB
testcase_19 AC 474 ms
201,052 KB
testcase_20 AC 462 ms
201,308 KB
testcase_21 AC 457 ms
201,096 KB
testcase_22 AC 461 ms
201,136 KB
testcase_23 AC 464 ms
201,212 KB
testcase_24 AC 462 ms
201,220 KB
testcase_25 AC 470 ms
201,372 KB
testcase_26 AC 457 ms
200,892 KB
testcase_27 AC 458 ms
201,040 KB
testcase_28 AC 461 ms
201,060 KB
testcase_29 AC 472 ms
201,172 KB
testcase_30 AC 468 ms
201,124 KB
testcase_31 AC 460 ms
200,772 KB
testcase_32 AC 462 ms
200,916 KB
testcase_33 AC 469 ms
200,920 KB
testcase_34 AC 464 ms
201,296 KB
testcase_35 AC 474 ms
201,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,LL=map(int,input().split())

x=10**7+1

import math 
L=math.floor(math.sqrt(x)) # 平方根を求める

Primelist=[i for i in range(x+1)]
Primelist[1]=0 # 1は素数でないので0にする.
 
for i in Primelist:
    if i>L:
        break
    if i==0:
        continue
    for j in range(2*i,x+1,i):
        Primelist[j]=0

Primes=[Primelist[j] for j in range(x+1) if Primelist[j]!=0]

ANS=0

for p in Primes:
    x=p*(N-1)

    if x<=LL:
        ANS+=(LL-x+1)
    else:
        break

print(ANS)
0