結果

問題 No.843 Triple Primes
ユーザー ntudantuda
提出日時 2024-02-03 19:03:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 585 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 444 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 175,352 KB
最終ジャッジ日時 2024-02-03 19:03:30
合計ジャッジ時間 14,225 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,588 KB
testcase_01 AC 585 ms
175,352 KB
testcase_02 AC 45 ms
61,972 KB
testcase_03 AC 44 ms
61,976 KB
testcase_04 AC 46 ms
64,156 KB
testcase_05 AC 45 ms
61,972 KB
testcase_06 AC 47 ms
64,148 KB
testcase_07 AC 396 ms
152,456 KB
testcase_08 AC 461 ms
159,368 KB
testcase_09 AC 559 ms
173,992 KB
testcase_10 AC 429 ms
153,888 KB
testcase_11 AC 495 ms
165,376 KB
testcase_12 AC 529 ms
170,072 KB
testcase_13 AC 503 ms
167,704 KB
testcase_14 AC 503 ms
167,720 KB
testcase_15 AC 396 ms
153,644 KB
testcase_16 AC 421 ms
153,796 KB
testcase_17 AC 34 ms
53,460 KB
testcase_18 AC 36 ms
53,588 KB
testcase_19 AC 35 ms
53,588 KB
testcase_20 AC 115 ms
90,056 KB
testcase_21 AC 80 ms
78,128 KB
testcase_22 AC 244 ms
123,372 KB
testcase_23 AC 246 ms
125,572 KB
testcase_24 AC 128 ms
92,020 KB
testcase_25 AC 110 ms
84,588 KB
testcase_26 AC 547 ms
173,960 KB
testcase_27 AC 52 ms
72,560 KB
testcase_28 AC 532 ms
168,992 KB
testcase_29 AC 129 ms
93,948 KB
testcase_30 AC 534 ms
170,656 KB
testcase_31 AC 64 ms
76,148 KB
testcase_32 AC 54 ms
70,484 KB
testcase_33 AC 142 ms
97,656 KB
testcase_34 AC 222 ms
117,848 KB
testcase_35 AC 561 ms
174,128 KB
testcase_36 AC 97 ms
81,952 KB
testcase_37 AC 369 ms
147,272 KB
testcase_38 AC 295 ms
133,832 KB
testcase_39 AC 525 ms
169,816 KB
testcase_40 AC 36 ms
53,588 KB
testcase_41 AC 34 ms
53,460 KB
testcase_42 AC 429 ms
157,500 KB
testcase_43 AC 502 ms
165,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
if N == 1:
    print(0)
    exit()
def seachPrimeNum(N):
    max = int(N**0.5)
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

PL = seachPrimeNum(N)
PLS = set(PL)
ans = 0
for r in PL:
    r2 = r * r
    if r2 > 2 * N:
        break
    for p in PL:
        if r2 - p in PLS:
            ans += 1
print(ans)




0