結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,136 KB
testcase_01 AC 553 ms
79,092 KB
testcase_02 AC 85 ms
76,512 KB
testcase_03 AC 87 ms
76,492 KB
testcase_04 AC 86 ms
76,496 KB
testcase_05 AC 87 ms
76,560 KB
testcase_06 AC 89 ms
76,524 KB
testcase_07 AC 415 ms
78,308 KB
testcase_08 AC 457 ms
78,476 KB
testcase_09 AC 525 ms
78,848 KB
testcase_10 AC 432 ms
78,368 KB
testcase_11 AC 480 ms
78,660 KB
testcase_12 AC 513 ms
78,636 KB
testcase_13 AC 496 ms
78,768 KB
testcase_14 AC 494 ms
78,400 KB
testcase_15 AC 421 ms
78,496 KB
testcase_16 AC 424 ms
78,212 KB
testcase_17 AC 75 ms
71,308 KB
testcase_18 AC 73 ms
71,212 KB
testcase_19 AC 74 ms
71,492 KB
testcase_20 AC 158 ms
76,480 KB
testcase_21 AC 118 ms
76,584 KB
testcase_22 WA -
testcase_23 AC 294 ms
77,284 KB
testcase_24 AC 167 ms
76,700 KB
testcase_25 AC 141 ms
76,300 KB
testcase_26 AC 523 ms
78,972 KB
testcase_27 AC 96 ms
76,468 KB
testcase_28 AC 509 ms
78,640 KB
testcase_29 AC 172 ms
76,516 KB
testcase_30 AC 516 ms
78,488 KB
testcase_31 AC 105 ms
76,340 KB
testcase_32 AC 97 ms
76,640 KB
testcase_33 AC 186 ms
76,524 KB
testcase_34 AC 263 ms
77,496 KB
testcase_35 AC 532 ms
78,956 KB
testcase_36 AC 132 ms
76,496 KB
testcase_37 AC 396 ms
78,192 KB
testcase_38 AC 334 ms
77,812 KB
testcase_39 AC 506 ms
78,540 KB
testcase_40 AC 76 ms
71,420 KB
testcase_41 AC 75 ms
71,076 KB
testcase_42 WA -
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
if N <= 1:
    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 = []
if N in P:
    R.append(N)
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