結果

問題 No.843 Triple Primes
ユーザー tpynerivertpyneriver
提出日時 2019-06-28 21:54:27
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 418 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 81,860 KB
実行使用メモリ 81,676 KB
最終ジャッジ日時 2023-10-19 17:43:10
合計ジャッジ時間 9,261 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,744 KB
testcase_01 AC 335 ms
81,676 KB
testcase_02 AC 48 ms
62,104 KB
testcase_03 AC 49 ms
62,104 KB
testcase_04 AC 51 ms
62,484 KB
testcase_05 AC 49 ms
62,104 KB
testcase_06 AC 51 ms
62,484 KB
testcase_07 AC 268 ms
80,844 KB
testcase_08 AC 289 ms
80,484 KB
testcase_09 AC 335 ms
81,676 KB
testcase_10 AC 277 ms
79,560 KB
testcase_11 AC 306 ms
80,464 KB
testcase_12 AC 326 ms
81,144 KB
testcase_13 AC 316 ms
80,492 KB
testcase_14 AC 316 ms
80,500 KB
testcase_15 AC 271 ms
80,432 KB
testcase_16 AC 275 ms
79,472 KB
testcase_17 AC 38 ms
53,512 KB
testcase_18 AC 38 ms
53,512 KB
testcase_19 AC 37 ms
53,744 KB
testcase_20 AC 104 ms
69,480 KB
testcase_21 AC 73 ms
66,580 KB
testcase_22 AC 182 ms
75,812 KB
testcase_23 AC 189 ms
76,220 KB
testcase_24 AC 107 ms
69,488 KB
testcase_25 AC 90 ms
67,032 KB
testcase_26 AC 335 ms
81,668 KB
testcase_27 AC 60 ms
64,532 KB
testcase_28 AC 320 ms
80,500 KB
testcase_29 AC 112 ms
69,716 KB
testcase_30 AC 327 ms
81,140 KB
testcase_31 AC 63 ms
64,532 KB
testcase_32 AC 55 ms
64,532 KB
testcase_33 AC 120 ms
69,740 KB
testcase_34 AC 170 ms
73,544 KB
testcase_35 AC 336 ms
81,676 KB
testcase_36 AC 86 ms
66,864 KB
testcase_37 AC 254 ms
79,512 KB
testcase_38 AC 213 ms
76,492 KB
testcase_39 AC 324 ms
81,140 KB
testcase_40 AC 38 ms
53,512 KB
testcase_41 AC 39 ms
53,512 KB
testcase_42 WA -
testcase_43 AC 307 ms
80,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def prsh(N):
    prime = [2]
    for L in range(3,N):
        for p in prime:
            if not L % p:
                break
            if p > L**(1/2):
                prime.append(L)
                break
    return prime

N = int(input())

ans = 0
if N >= 2:
    ans += 1
plist = prsh(N)
pset = set(plist)
if 2 in pset:
    plist.remove(2)
for p1 in plist:
    if (p1**2 - 2) in pset:
        ans += 2
print(ans)
0