結果

問題 No.843 Triple Primes
ユーザー titiatitia
提出日時 2019-06-28 21:36:57
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 742 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 87,484 KB
最終ジャッジ日時 2023-09-14 21:42:02
合計ジャッジ時間 6,810 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,396 KB
testcase_01 AC 141 ms
87,484 KB
testcase_02 AC 80 ms
76,316 KB
testcase_03 AC 78 ms
76,312 KB
testcase_04 AC 78 ms
76,464 KB
testcase_05 AC 79 ms
76,460 KB
testcase_06 AC 78 ms
76,052 KB
testcase_07 AC 116 ms
84,768 KB
testcase_08 AC 123 ms
85,876 KB
testcase_09 AC 141 ms
87,396 KB
testcase_10 AC 122 ms
84,868 KB
testcase_11 AC 130 ms
86,192 KB
testcase_12 AC 136 ms
87,332 KB
testcase_13 AC 137 ms
86,256 KB
testcase_14 AC 130 ms
86,140 KB
testcase_15 AC 116 ms
84,752 KB
testcase_16 AC 119 ms
85,008 KB
testcase_17 AC 74 ms
71,424 KB
testcase_18 WA -
testcase_19 AC 73 ms
71,392 KB
testcase_20 AC 87 ms
78,224 KB
testcase_21 AC 84 ms
76,672 KB
testcase_22 AC 99 ms
81,332 KB
testcase_23 AC 101 ms
82,408 KB
testcase_24 AC 88 ms
78,368 KB
testcase_25 AC 88 ms
77,392 KB
testcase_26 AC 139 ms
87,408 KB
testcase_27 AC 79 ms
76,504 KB
testcase_28 AC 133 ms
86,360 KB
testcase_29 AC 87 ms
78,600 KB
testcase_30 AC 136 ms
87,360 KB
testcase_31 AC 82 ms
76,716 KB
testcase_32 AC 81 ms
76,664 KB
testcase_33 AC 90 ms
78,888 KB
testcase_34 AC 97 ms
81,336 KB
testcase_35 AC 138 ms
87,440 KB
testcase_36 AC 88 ms
77,008 KB
testcase_37 AC 116 ms
84,592 KB
testcase_38 AC 103 ms
82,472 KB
testcase_39 AC 138 ms
87,056 KB
testcase_40 WA -
testcase_41 AC 72 ms
71,048 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