結果
| 問題 |
No.1657 Sum is Prime (Easy Version)
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2021-08-28 17:00:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,979 ms / 2,000 ms |
| コード長 | 502 bytes |
| コンパイル時間 | 245 ms |
| コンパイル使用メモリ | 82,280 KB |
| 実行使用メモリ | 258,364 KB |
| 最終ジャッジ日時 | 2024-11-21 21:07:25 |
| 合計ジャッジ時間 | 20,104 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
L,R = map(int,input().split())
def seachPrimeNum(N):
max = int(N**0.5)
seachList = [i for i in range(2,N+1)]
primeNum = []
while seachList[0] <= max:
primeNum.append(seachList[0])
tmp = seachList[0]
seachList = [i for i in seachList if i % tmp != 0]
primeNum.extend(seachList)
return primeNum
P = set(seachPrimeNum(2*R))
ans = 0
for i in range(L,R):
if i in P:
ans += 1
if 2*i+1 in P:
ans += 1
if R in P:
ans += 1
print(ans)
ntuda