結果
| 問題 |
No.843 Triple Primes
|
| コンテスト | |
| ユーザー |
mkawa2
|
| 提出日時 | 2019-07-03 21:02:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 146 ms / 2,000 ms |
| コード長 | 384 bytes |
| コンパイル時間 | 580 ms |
| コンパイル使用メモリ | 82,460 KB |
| 実行使用メモリ | 75,392 KB |
| 最終ジャッジ日時 | 2024-09-19 14:16:28 |
| 合計ジャッジ時間 | 5,595 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 42 |
ソースコード
n=int(input())
if n==1:
print(0)
exit()
elif n==2:
print(1)
exit()
ele=[]
for i in range(3,n+1,2):
for e in ele:
if i%e==0:
break
if e**2>i:
ele.append(i)
break
else:
ele.append(i)
sel=set(ele)
cnt=0
for r in ele:
p=r**2-2
if p in sel:
cnt+=1
if p>n:
break
print(cnt*2+1)
mkawa2