結果

問題 No.843 Triple Primes
ユーザー NagisaNagisa
提出日時 2019-06-28 21:47:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 415 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 79,080 KB
最終ジャッジ日時 2023-09-14 21:49:36
合計ジャッジ時間 14,434 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,344 KB
testcase_01 AC 531 ms
79,080 KB
testcase_02 AC 83 ms
76,720 KB
testcase_03 AC 84 ms
76,824 KB
testcase_04 AC 88 ms
76,740 KB
testcase_05 AC 86 ms
76,608 KB
testcase_06 AC 86 ms
76,432 KB
testcase_07 AC 411 ms
78,356 KB
testcase_08 AC 454 ms
78,840 KB
testcase_09 AC 524 ms
79,068 KB
testcase_10 AC 428 ms
78,280 KB
testcase_11 AC 476 ms
78,868 KB
testcase_12 AC 514 ms
78,488 KB
testcase_13 AC 497 ms
78,776 KB
testcase_14 AC 497 ms
78,628 KB
testcase_15 AC 422 ms
78,272 KB
testcase_16 AC 427 ms
78,320 KB
testcase_17 AC 74 ms
71,340 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 156 ms
76,588 KB
testcase_21 AC 116 ms
76,740 KB
testcase_22 AC 280 ms
77,512 KB
testcase_23 AC 293 ms
77,772 KB
testcase_24 AC 166 ms
76,516 KB
testcase_25 AC 139 ms
76,844 KB
testcase_26 AC 524 ms
78,772 KB
testcase_27 AC 95 ms
76,636 KB
testcase_28 AC 501 ms
78,696 KB
testcase_29 AC 170 ms
76,592 KB
testcase_30 AC 516 ms
78,528 KB
testcase_31 AC 102 ms
76,584 KB
testcase_32 AC 93 ms
76,532 KB
testcase_33 AC 184 ms
76,628 KB
testcase_34 AC 259 ms
77,464 KB
testcase_35 AC 525 ms
78,972 KB
testcase_36 AC 132 ms
76,712 KB
testcase_37 AC 398 ms
78,388 KB
testcase_38 AC 332 ms
77,768 KB
testcase_39 AC 504 ms
78,880 KB
testcase_40 WA -
testcase_41 AC 74 ms
71,172 KB
testcase_42 WA -
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
if N <= 3:
    print(0)
    exit(0)


import math
P = [2]
for k in range(3,N+1):
    f = 1
    for l in range(2,int(math.sqrt(k))+1):
        if k % l == 0:
            f = 0
            break
    if f==1:
        P.append(k)

R = []
for e in P:
    if e*e < N:
        R.append(e*e)
    else:
        break


l = len(P)
ans = 1
for k in range(1,l):
    if 2+P[k] in R:
        ans += 2
print(ans)
0