結果

問題 No.843 Triple Primes
ユーザー pluto77pluto77
提出日時 2019-07-01 11:23:00
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 203 ms / 2,000 ms
コード長 293 bytes
コンパイル時間 1,342 ms
コンパイル使用メモリ 77,112 KB
実行使用メモリ 84,760 KB
最終ジャッジ日時 2023-10-19 17:57:29
合計ジャッジ時間 8,478 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
76,028 KB
testcase_01 AC 203 ms
84,228 KB
testcase_02 AC 81 ms
78,188 KB
testcase_03 AC 80 ms
78,188 KB
testcase_04 AC 81 ms
78,468 KB
testcase_05 AC 80 ms
78,188 KB
testcase_06 AC 82 ms
78,468 KB
testcase_07 AC 170 ms
83,780 KB
testcase_08 AC 180 ms
84,712 KB
testcase_09 AC 197 ms
84,248 KB
testcase_10 AC 174 ms
83,816 KB
testcase_11 AC 186 ms
84,760 KB
testcase_12 AC 195 ms
84,212 KB
testcase_13 AC 191 ms
84,432 KB
testcase_14 AC 192 ms
84,432 KB
testcase_15 AC 172 ms
83,796 KB
testcase_16 AC 174 ms
83,808 KB
testcase_17 AC 73 ms
76,160 KB
testcase_18 AC 73 ms
76,160 KB
testcase_19 AC 72 ms
76,160 KB
testcase_20 AC 104 ms
79,032 KB
testcase_21 AC 92 ms
78,468 KB
testcase_22 AC 136 ms
81,468 KB
testcase_23 AC 140 ms
81,884 KB
testcase_24 AC 106 ms
79,044 KB
testcase_25 AC 99 ms
78,636 KB
testcase_26 AC 198 ms
84,248 KB
testcase_27 AC 85 ms
78,468 KB
testcase_28 AC 192 ms
83,112 KB
testcase_29 AC 108 ms
79,272 KB
testcase_30 AC 195 ms
84,212 KB
testcase_31 AC 87 ms
78,468 KB
testcase_32 AC 83 ms
78,468 KB
testcase_33 AC 110 ms
79,292 KB
testcase_34 AC 134 ms
81,236 KB
testcase_35 AC 198 ms
84,248 KB
testcase_36 AC 97 ms
78,468 KB
testcase_37 AC 167 ms
83,740 KB
testcase_38 AC 150 ms
82,180 KB
testcase_39 AC 193 ms
84,200 KB
testcase_40 AC 71 ms
76,160 KB
testcase_41 AC 71 ms
76,160 KB
testcase_42 AC 176 ms
84,400 KB
testcase_43 AC 185 ms
84,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki843
import sys

x=int(raw_input())
if x<2:
 print 0
 sys.exit()
def prime_list(x):
 pl=[2]
 for i in range(3,x+1):
  for j in pl:
   if j*j>i:
    pl.append(i)
    break
   if i%j==0:
    break
 return pl

p=prime_list(x)
s=set(p)
res=1
for i in p[1:]:
 if i*i-2 in s:
  res+=2
print res
0