結果

問題 No.843 Triple Primes
ユーザー ntuda
提出日時 2024-02-03 18:58:43
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 512 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 82,148 KB
実行使用メモリ 175,556 KB
最終ジャッジ日時 2024-09-28 10:57:37
合計ジャッジ時間 13,668 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 40 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
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