結果

問題 No.1657 Sum is Prime (Easy Version)
ユーザー DrDrpilot
提出日時 2022-02-10 14:35:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 380 bytes
コンパイル時間 487 ms
コンパイル使用メモリ 82,456 KB
実行使用メモリ 76,936 KB
最終ジャッジ日時 2024-06-25 20:56:14
合計ジャッジ時間 12,393 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 6
権限があれば一括ダウンロードができます

ソースコード

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