結果

問題 No.2750 Number of Prime Factors
ユーザー PNJPNJ
提出日時 2024-05-10 23:19:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 438 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 66,500 KB
最終ジャッジ日時 2024-05-10 23:19:35
合計ジャッジ時間 2,072 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
64,576 KB
testcase_01 AC 52 ms
64,640 KB
testcase_02 AC 52 ms
64,456 KB
testcase_03 AC 51 ms
65,932 KB
testcase_04 AC 61 ms
64,836 KB
testcase_05 AC 64 ms
64,816 KB
testcase_06 AC 52 ms
64,204 KB
testcase_07 AC 55 ms
66,212 KB
testcase_08 AC 52 ms
65,252 KB
testcase_09 AC 51 ms
66,500 KB
testcase_10 AC 52 ms
65,312 KB
testcase_11 AC 52 ms
64,780 KB
testcase_12 AC 52 ms
65,812 KB
testcase_13 AC 53 ms
65,124 KB
testcase_14 AC 52 ms
65,688 KB
testcase_15 AC 51 ms
65,700 KB
testcase_16 AC 52 ms
64,664 KB
testcase_17 AC 53 ms
65,412 KB
testcase_18 AC 52 ms
64,732 KB
testcase_19 AC 51 ms
65,244 KB
testcase_20 AC 51 ms
65,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Eratosthenes(N):
  is_prime = [1 for i in range(N+1)]
  is_prime[0] = is_prime[1] = 0
  P = []
  for p in range(2,N+1):
    if is_prime[p] == 0:
      continue
    P.append(p)
    for d in range(2,N//p+1):
      q = p*d
      is_prime[q] = 0
  return P

P = Eratosthenes(200000)

N = int(input())
ans = 0
for p in P:
  if p == 2:
    ans = 1
    g = 2
    continue
  if g * p <= N:
    ans += 1
    g *= p
  else:
    break
print(ans)
0