結果

問題 No.843 Triple Primes
ユーザー titiatitia
提出日時 2019-06-28 21:34:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 601 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 87,556 KB
最終ジャッジ日時 2023-09-14 21:39:57
合計ジャッジ時間 6,781 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,532 KB
testcase_01 AC 140 ms
87,464 KB
testcase_02 AC 78 ms
76,120 KB
testcase_03 AC 82 ms
76,260 KB
testcase_04 AC 79 ms
76,312 KB
testcase_05 AC 79 ms
76,256 KB
testcase_06 AC 80 ms
76,064 KB
testcase_07 AC 117 ms
84,496 KB
testcase_08 AC 124 ms
86,104 KB
testcase_09 AC 137 ms
87,556 KB
testcase_10 AC 118 ms
84,592 KB
testcase_11 AC 127 ms
86,136 KB
testcase_12 AC 134 ms
87,352 KB
testcase_13 AC 135 ms
86,020 KB
testcase_14 AC 130 ms
86,420 KB
testcase_15 AC 114 ms
84,828 KB
testcase_16 AC 119 ms
85,012 KB
testcase_17 AC 72 ms
71,040 KB
testcase_18 WA -
testcase_19 AC 72 ms
71,156 KB
testcase_20 AC 85 ms
78,292 KB
testcase_21 AC 82 ms
76,884 KB
testcase_22 AC 99 ms
81,664 KB
testcase_23 AC 97 ms
82,280 KB
testcase_24 AC 85 ms
78,432 KB
testcase_25 AC 87 ms
77,612 KB
testcase_26 AC 137 ms
87,044 KB
testcase_27 AC 80 ms
76,336 KB
testcase_28 AC 135 ms
86,192 KB
testcase_29 AC 88 ms
78,588 KB
testcase_30 AC 134 ms
87,388 KB
testcase_31 AC 81 ms
76,740 KB
testcase_32 AC 80 ms
76,580 KB
testcase_33 AC 88 ms
78,740 KB
testcase_34 AC 97 ms
81,308 KB
testcase_35 AC 136 ms
87,420 KB
testcase_36 AC 87 ms
77,344 KB
testcase_37 AC 112 ms
84,596 KB
testcase_38 AC 101 ms
82,472 KB
testcase_39 AC 133 ms
86,756 KB
testcase_40 WA -
testcase_41 AC 70 ms
71,208 KB
testcase_42 WA -
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

x=int(input())

#x=5*10**5

import math 
L=math.floor(math.sqrt(x))#平方根を求める

Primelist=[i for i in range(x+1)]
Primelist[1]=0#1は素数でないので0にする.
 
for i in Primelist:
    if i>L:
        break
    if i==0:
        continue
    for j in range(2*i,x+1,i):
        Primelist[j]=0

Primes=[Primelist[j] for j in range(x+1) if Primelist[j]!=0]
SP=set(Primes)

ANS=0
for b in Primes:
    if b>math.sqrt(x):
        break

    for y in Primes:
        if y>=b**2:
            break
        if b**2-y in SP:
            ANS+=1

print(ANS)
0