結果

問題 No.843 Triple Primes
ユーザー amyuamyu
提出日時 2019-06-28 22:53:04
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 1,189 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 11,896 KB
実行使用メモリ 14,172 KB
最終ジャッジ日時 2023-10-19 17:51:39
合計ジャッジ時間 26,594 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,084 KB
testcase_01 AC 1,189 ms
14,172 KB
testcase_02 AC 34 ms
10,144 KB
testcase_03 AC 33 ms
10,140 KB
testcase_04 AC 37 ms
10,168 KB
testcase_05 AC 33 ms
10,140 KB
testcase_06 AC 38 ms
10,172 KB
testcase_07 AC 882 ms
13,872 KB
testcase_08 AC 1,015 ms
13,984 KB
testcase_09 AC 1,148 ms
14,160 KB
testcase_10 AC 959 ms
13,920 KB
testcase_11 AC 1,042 ms
14,044 KB
testcase_12 AC 1,118 ms
14,128 KB
testcase_13 AC 1,085 ms
14,088 KB
testcase_14 AC 1,104 ms
14,092 KB
testcase_15 AC 939 ms
13,892 KB
testcase_16 AC 919 ms
13,912 KB
testcase_17 AC 28 ms
10,084 KB
testcase_18 AC 29 ms
10,084 KB
testcase_19 AC 28 ms
10,084 KB
testcase_20 AC 263 ms
11,216 KB
testcase_21 AC 135 ms
10,984 KB
testcase_22 AC 560 ms
13,488 KB
testcase_23 AC 588 ms
13,524 KB
testcase_24 AC 269 ms
11,216 KB
testcase_25 AC 197 ms
11,012 KB
testcase_26 AC 1,142 ms
14,156 KB
testcase_27 AC 61 ms
10,232 KB
testcase_28 AC 1,095 ms
14,100 KB
testcase_29 AC 287 ms
11,216 KB
testcase_30 AC 1,149 ms
14,136 KB
testcase_31 AC 90 ms
10,296 KB
testcase_32 AC 57 ms
10,220 KB
testcase_33 AC 312 ms
11,216 KB
testcase_34 AC 557 ms
13,420 KB
testcase_35 AC 1,160 ms
14,160 KB
testcase_36 AC 179 ms
11,060 KB
testcase_37 AC 843 ms
13,824 KB
testcase_38 AC 695 ms
13,636 KB
testcase_39 AC 1,106 ms
14,116 KB
testcase_40 AC 29 ms
10,084 KB
testcase_41 AC 28 ms
10,084 KB
testcase_42 AC 985 ms
13,948 KB
testcase_43 AC 1,035 ms
14,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
if(n==1):
    print(0)
    quit()
p=[2]
for i in range(3,n+1):
    for j in p:
        if j*j>i:
            p.append(i)
            break
        if i%j==0:
            break
s=set(p)
ans=1
for i in p[1:]:
    if i*i-2 in s:
        ans+=2
print(ans)
0