結果
| 問題 |
No.843 Triple Primes
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2024-02-03 19:03:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 561 ms / 2,000 ms |
| コード長 | 547 bytes |
| コンパイル時間 | 278 ms |
| コンパイル使用メモリ | 81,860 KB |
| 実行使用メモリ | 175,580 KB |
| 最終ジャッジ日時 | 2024-09-28 10:58:16 |
| 合計ジャッジ時間 | 13,257 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 42 |
ソースコード
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)
ntuda