結果

問題 No.843 Triple Primes
ユーザー ああいいああいい
提出日時 2022-01-01 23:30:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 285 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,096 KB
最終ジャッジ日時 2024-04-18 23:51:17
合計ジャッジ時間 8,020 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,752 KB
testcase_01 AC 263 ms
17,996 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 33 ms
10,880 KB
testcase_05 AC 33 ms
10,880 KB
testcase_06 AC 33 ms
10,880 KB
testcase_07 AC 218 ms
17,020 KB
testcase_08 AC 246 ms
17,392 KB
testcase_09 AC 270 ms
17,980 KB
testcase_10 AC 233 ms
17,024 KB
testcase_11 AC 278 ms
17,552 KB
testcase_12 AC 260 ms
17,888 KB
testcase_13 AC 255 ms
17,652 KB
testcase_14 AC 271 ms
17,788 KB
testcase_15 AC 216 ms
17,112 KB
testcase_16 AC 232 ms
17,152 KB
testcase_17 AC 29 ms
10,880 KB
testcase_18 AC 29 ms
10,880 KB
testcase_19 AC 28 ms
10,880 KB
testcase_20 AC 94 ms
12,800 KB
testcase_21 AC 65 ms
12,032 KB
testcase_22 AC 164 ms
16,000 KB
testcase_23 AC 162 ms
16,128 KB
testcase_24 AC 92 ms
12,800 KB
testcase_25 AC 77 ms
12,544 KB
testcase_26 AC 264 ms
18,096 KB
testcase_27 AC 41 ms
11,264 KB
testcase_28 AC 266 ms
17,696 KB
testcase_29 AC 97 ms
12,800 KB
testcase_30 AC 269 ms
17,784 KB
testcase_31 AC 49 ms
11,264 KB
testcase_32 AC 41 ms
11,136 KB
testcase_33 AC 104 ms
13,056 KB
testcase_34 AC 154 ms
15,872 KB
testcase_35 AC 284 ms
17,980 KB
testcase_36 AC 72 ms
12,288 KB
testcase_37 AC 207 ms
16,896 KB
testcase_38 AC 196 ms
16,384 KB
testcase_39 AC 285 ms
17,728 KB
testcase_40 AC 26 ms
10,752 KB
testcase_41 AC 28 ms
10,880 KB
testcase_42 AC 249 ms
17,244 KB
testcase_43 AC 254 ms
17,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

prime = set()
dat = [0] * (N + 1)

for i in range(2,N + 1):
    if dat[i] == 0:
        prime.add(i)
        for j in range(i * 2,N + 1,i):
            dat[j] = 1
ans = 0

if N >= 2:
    ans -= 1
count = 0
for r in prime:
    if r ** 2 - 2 in prime:
        count += 1
print(ans + count * 2)
0