結果

問題 No.1657 Sum is Prime (Easy Version)
ユーザー DrDrpilotDrDrpilot
提出日時 2022-02-10 14:35:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 380 bytes
コンパイル時間 905 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 78,224 KB
最終ジャッジ日時 2023-09-08 03:44:20
合計ジャッジ時間 16,002 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,412 KB
testcase_01 AC 71 ms
71,360 KB
testcase_02 AC 1,748 ms
77,964 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 72 ms
71,552 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 79 ms
75,604 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 112 ms
77,684 KB
testcase_12 AC 1,611 ms
77,684 KB
testcase_13 AC 653 ms
78,064 KB
testcase_14 AC 868 ms
77,876 KB
testcase_15 AC 1,093 ms
77,580 KB
testcase_16 AC 335 ms
78,208 KB
testcase_17 AC 151 ms
77,976 KB
testcase_18 AC 221 ms
78,116 KB
testcase_19 AC 1,620 ms
78,120 KB
testcase_20 AC 516 ms
78,224 KB
testcase_21 AC 1,916 ms
77,764 KB
testcase_22 AC 74 ms
71,444 KB
testcase_23 AC 312 ms
77,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

l,r=map(int,input().split())
ans=0
import math
def isprime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        if n % i == 0: return False
    return True
for a in range(l,r+1):
    if isprime(a):
        ans+=1
    if isprime(2*a+1):
        ans+=1
print(ans) 
0