結果

問題 No.1657 Sum is Prime (Easy Version)
ユーザー googol_S0googol_S0
提出日時 2021-08-27 21:26:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 266 ms / 2,000 ms
コード長 261 bytes
コンパイル時間 965 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 116,096 KB
最終ジャッジ日時 2023-08-13 07:51:53
合計ジャッジ時間 6,333 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 190 ms
115,736 KB
testcase_01 AC 189 ms
116,016 KB
testcase_02 AC 250 ms
116,024 KB
testcase_03 AC 185 ms
115,844 KB
testcase_04 AC 184 ms
116,028 KB
testcase_05 AC 191 ms
115,980 KB
testcase_06 AC 183 ms
115,968 KB
testcase_07 AC 183 ms
115,860 KB
testcase_08 AC 181 ms
115,856 KB
testcase_09 AC 188 ms
115,852 KB
testcase_10 AC 186 ms
115,756 KB
testcase_11 AC 196 ms
116,048 KB
testcase_12 AC 237 ms
116,092 KB
testcase_13 AC 209 ms
115,764 KB
testcase_14 AC 218 ms
116,096 KB
testcase_15 AC 217 ms
115,940 KB
testcase_16 AC 196 ms
116,004 KB
testcase_17 AC 196 ms
115,896 KB
testcase_18 AC 195 ms
115,960 KB
testcase_19 AC 256 ms
115,976 KB
testcase_20 AC 199 ms
115,920 KB
testcase_21 AC 266 ms
115,892 KB
testcase_22 AC 176 ms
116,024 KB
testcase_23 AC 191 ms
115,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

L,R=map(int,input().split())
P=set()
M=2100000
F=[0]*M
for i in range(2,M):
  if F[i]:
    continue
  P.add(i)
  for j in range(i*2,M,i):
    F[j]=1
ANS=0
for i in range(L,R+1):
  if i in P:
    ANS+=1
  if i==R:
    break
  if i*2+1 in P:
    ANS+=1
print(ANS)
0