結果

問題 No.843 Triple Primes
ユーザー sho_00sho_00
提出日時 2020-04-11 20:09:17
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 535 bytes
コンパイル時間 2,185 ms
コンパイル使用メモリ 75,284 KB
実行使用メモリ 173,820 KB
最終ジャッジ日時 2023-10-19 12:16:54
合計ジャッジ時間 7,430 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,560 KB
testcase_01 TLE -
testcase_02 AC 47 ms
61,528 KB
testcase_03 AC 46 ms
59,480 KB
testcase_04 AC 50 ms
63,956 KB
testcase_05 AC 46 ms
61,528 KB
testcase_06 AC 50 ms
63,956 KB
testcase_07 AC 1,607 ms
152,172 KB
testcase_08 AC 1,874 ms
159,036 KB
testcase_09 TLE -
testcase_10 AC 1,711 ms
153,756 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 1,654 ms
153,228 KB
testcase_16 AC 1,694 ms
153,492 KB
testcase_17 AC 39 ms
53,500 KB
testcase_18 AC 39 ms
53,560 KB
testcase_19 AC 39 ms
53,560 KB
testcase_20 AC 287 ms
89,936 KB
testcase_21 AC 133 ms
78,052 KB
testcase_22 AC 860 ms
123,200 KB
testcase_23 AC 923 ms
125,312 KB
testcase_24 AC 313 ms
91,784 KB
testcase_25 AC 214 ms
84,392 KB
testcase_26 TLE -
testcase_27 AC 65 ms
72,368 KB
testcase_28 TLE -
testcase_29 AC 346 ms
93,632 KB
testcase_30 TLE -
testcase_31 AC 88 ms
76,160 KB
testcase_32 AC 61 ms
70,292 KB
testcase_33 AC 407 ms
97,328 KB
testcase_34 AC 757 ms
117,656 KB
testcase_35 TLE -
testcase_36 AC 184 ms
81,752 KB
testcase_37 AC 1,501 ms
146,892 KB
testcase_38 AC 1,126 ms
133,760 KB
testcase_39 TLE -
testcase_40 AC 39 ms
53,560 KB
testcase_41 AC 40 ms
53,500 KB
testcase_42 AC 1,777 ms
157,188 KB
testcase_43 TLE -
権限があれば一括ダウンロードができます

ソースコード

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