結果

問題 No.144 エラトステネスのざる
ユーザー maspy
提出日時 2020-01-01 19:16:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 456 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 55,988 KB
最終ジャッジ日時 2024-11-22 16:00:30
合計ジャッジ時間 13,837 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 5 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N,p = read().split()
N = int(N); p = float(p)

div_cnt = np.zeros(N+1,np.int32)

for x in range(1,int(N**.5)+10):
    if x * x > N:
        break
    div_cnt[x*x] += 1
    div_cnt[x*(x+1):N+1:x] += 2

div_cnt -= 2

counter = np.bincount(div_cnt[2:])

answer = sum(p ** i * x for i,x in enumerate(counter))
print(answer)
0