結果

問題 No.1657 Sum is Prime (Easy Version)
ユーザー googol_S0googol_S0
提出日時 2021-08-27 21:26:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 253 ms / 2,000 ms
コード長 261 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,060 KB
実行使用メモリ 110,824 KB
最終ジャッジ日時 2024-05-01 01:35:54
合計ジャッジ時間 5,847 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 165 ms
108,860 KB
testcase_01 AC 175 ms
108,440 KB
testcase_02 AC 232 ms
109,736 KB
testcase_03 AC 171 ms
109,084 KB
testcase_04 AC 167 ms
108,484 KB
testcase_05 AC 164 ms
107,752 KB
testcase_06 AC 184 ms
109,648 KB
testcase_07 AC 168 ms
109,172 KB
testcase_08 AC 164 ms
107,980 KB
testcase_09 AC 164 ms
109,416 KB
testcase_10 AC 164 ms
109,496 KB
testcase_11 AC 170 ms
109,896 KB
testcase_12 AC 223 ms
110,196 KB
testcase_13 AC 190 ms
110,824 KB
testcase_14 AC 193 ms
110,564 KB
testcase_15 AC 212 ms
110,016 KB
testcase_16 AC 189 ms
110,376 KB
testcase_17 AC 188 ms
109,692 KB
testcase_18 AC 184 ms
109,184 KB
testcase_19 AC 243 ms
110,128 KB
testcase_20 AC 195 ms
109,252 KB
testcase_21 AC 253 ms
110,212 KB
testcase_22 AC 163 ms
108,804 KB
testcase_23 AC 177 ms
110,672 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