結果

問題 No.144 エラトステネスのざる
ユーザー H3PO4H3PO4
提出日時 2020-05-06 11:08:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 228 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,592 KB
実行使用メモリ 29,600 KB
最終ジャッジ日時 2023-09-10 19:55:24
合計ジャッジ時間 8,886 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
29,544 KB
testcase_01 AC 136 ms
29,480 KB
testcase_02 AC 140 ms
29,600 KB
testcase_03 AC 138 ms
29,412 KB
testcase_04 AC 136 ms
29,484 KB
testcase_05 AC 137 ms
29,508 KB
testcase_06 AC 149 ms
29,540 KB
testcase_07 AC 139 ms
29,508 KB
testcase_08 AC 142 ms
29,548 KB
testcase_09 AC 140 ms
29,468 KB
testcase_10 AC 141 ms
29,564 KB
testcase_11 AC 139 ms
29,576 KB
testcase_12 AC 140 ms
29,524 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N, P = input().split()
N = int(N)
P = float(P)

factor = np.zeros(N + 1, dtype=int)
for i in range(2, N + 1):
    factor[i * 2:N + 1:i] += 1

ans = .0
for x in factor[2:]:
    ans += pow(1 - P, x)
print(ans)
0