結果

問題 No.843 Triple Primes
ユーザー sho_00
提出日時 2020-04-11 20:09:17
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 535 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 82,320 KB
実行使用メモリ 175,744 KB
最終ジャッジ日時 2024-09-19 08:20:10
合計ジャッジ時間 43,620 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 TLE * 1
other AC * 33 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import math,sys

N=int(input())
if N==1:
  print(0)
  sys.exit()

def searchPrimeNum(N):  # 素数列挙 こっち使う
  max = int(math.sqrt(N))
  searchList = [i for i in range(2,N+1)]
  primeNum = []
  while searchList[0] <= max:
    primeNum.append(searchList[0])
    tmp = searchList[0]
    searchList = [i for i in searchList if i % tmp != 0]
  primeNum.extend(searchList)
  return primeNum


table=searchPrimeNum(N)
cnt=0
for r in table:
  p=r**2-2
  if p in table:
    if p!=2:
      cnt+=2
    else:
      cnt+=1
print(cnt)
0